**RUBI**, the RUle-Based Integrator package, does what you want.

You can download a copy of the rules to use with `Mathematica`

at this link: http://www.apmaths.uwo.ca/~arich/. Follow the instructions to install and make sure that you select the option to "Show Steps". The package's `Int`

command performs indefinite integration and will also show the substitution rules it used to get to the final result.

Suppose for instance that you want to obtain the antiderivative from $\int{x^2 \sin{x} \ \text{d} x}$. Using RUBI's `Int`

command:

```
Int[x^2 Sin[x], x]
```

This has applied one of the rules in RUBI's rule base to simplify the integral. The intermediate results can be simplified further by evaluating them in turn:

```
-x^2 Cos[x] + Dist[2, Int[x Cos[x], x], x]
```

```
-x^2 Cos[x] + 2 x Sin[x] - Dist[2, Int[Sin[x], x], x]
```

Once further evaluations do not change the expression any more, the last output is the antiderivative we sought.

If you have an answer for indefinite integral, just take its derivative and you will get the steps of the integration in backward direction. – Vahagn Poghosyan – 2013-09-20T20:45:10.810

@VahagnPoghosyan that's not what W|A gives ... does it? – Santosh Linkha – 2013-09-20T20:45:51.367

Sorry, but I have no Wolfram Alpha. It is not a free software and I can't find a cracked version. I gave you only theoretical idea. – Vahagn Poghosyan – 2013-09-20T20:48:11.417

@VahagnPoghosyan yes i thought of that too ... but if I post that as solution, that will definitely get rejected. I mean I just want to know if it is possible or not. I don't know coding in Mathematica and although I have heard that Risch algorithm is used to find closed solution of Indefinite integrals, so far I haven't encountered myself. If it's not easily done then ... i should give up. – Santosh Linkha – 2013-09-20T20:51:48.057

When I was a student, I used this trick of taking integrals during lectures and exams. I simply took integral by MATHEMATICA, then took its derivative step-by-step, and got steps of the integration :) I think it is possible to

easily realize the code. – Vahagn Poghosyan – 2013-09-20T21:02:07.500

@VahagnPoghosyan when i was in HS, if i couldn't solve an indefinite integral, i would check the answers on the last page of my textbook and differentiate and construct the answer. But I found it so different from the way it is generally solved, that I gave away that approach. LOL ... it's not nice. But I have to admit, it is equivalent solution. – Santosh Linkha – 2013-09-20T21:10:58.163

Yes I know, it's not nice. Anyway, what is the purpose to write your own code ? – Vahagn Poghosyan – 2013-09-20T21:28:49.943

What is the use of all this? I mean that depending upon your aim one can think of different approaches. Is it for the classroom sessions? Or what? – Alexei Boulbitch – 2015-09-30T07:58:19.260