# Why can't Mathematica integrate this?

Integrate[(x^2 + 2 x + 1 + (3 x + 1) Sqrt[x + Log[x]])/(x Sqrt[x +
Log[x]] (x + Sqrt[x + Log[x]])), x]


(It just returned integral in symbolic form and did nothing.)

• Is that supposed to be doable? Mathematica can not do the impossible. – bobbym Sep 29 '16 at 8:45
• I'm voting to close this question as off-topic because the issue it raises is not really a Mathematica issue but a matter of the OP not having grasped the mathematics involved. – m_goldberg Sep 29 '16 at 13:52
• I think this was closed due to the community not having grasped the mathematics involved. ;-) See my answer. – Michael E2 Sep 29 '16 at 17:34
• Hmm, this has been asked before...I have just accidentally ran across this exact example in an old SE notebook, but alas no link to the question. Or maybe it was on math.SE. – Michael E2 Sep 29 '16 at 17:43
• Aha! Found it: (109690)-- Well, I guess I did do pretty much the same thing there, too. – Michael E2 Sep 29 '16 at 20:08

One way to find out why M can not do an indefinite integral, is to run Rubi integration package on it. Since Rubi shows step by step integration, most of the time, when Rubi gets stuck on a step, it will also be the same with Mathematica. This can point out which part of the larger integral where M was not able to do.

When doing this, here is a small integral, generated during Rubi's steps, that shows possible place where M gave up.

 Integrate[x/(x - Log[x]), x]


The above can't be integrated. Rubi can't do it. M can't do it. Maple can't do it. Maxima can't do it. If all these programs can't do it, then I do not think we humans have any chance, so will not even try.

The above is just a very small version of small part of what your integral contains, when it is broken up.

The point is, not every integral can be solved analytically.

Rubi input

Int[(x^2 + 2 x + 1 + (3 x + 1) Sqrt[x + Log[x]])/(x Sqrt[
x + Log[x]] (x + Sqrt[x + Log[x]])), x]


Rubi output at the step it got stuck

Log[Log[25*x]] + Dist[2, Int[x/(-x + x^2 - Log[x]), x], x] +
Dist[2, Int[1/Sqrt[x + Log[x]], x], x] -
Int[1/(-x + x^2 - Log[x]), x] -
Int[1/((-1 + x)*(-x + x^2 - Log[x])), x] +
Int[1/((-1 + x)*x*(-x + x^2 - Log[x])), x] +
Int[1/Sqrt[x + Log[x]], x] +
Int[1/(x*Sqrt[x + Log[x]]), x] +
Int[(1 + x - 2*x^2)/((-x + x^2 - Log[x])*Sqrt[x + Log[x]]), x] -
Int[1/((-1 + x)*Log[25*x]), x] +
Int[1/((-1 + x)*x*Log[25*x]), x]


In all the above, where you see Int[.....] next to them, means it can not be integrated. Pick any and try it.

So your integral generated 10 or 15 smaller integrals that can't be solved. So it is better to start with trying to solve one of the smaller ones first.

Version 11 on windows 7.

• Very instructive; can you explain how you got the details with the "Rubi integration package"? – anderstood Sep 29 '16 at 18:46
• Ah OK, I thought there were a MMA package called "Rubi integration" which gave computation details. Now I understand. – anderstood Sep 29 '16 at 19:00

Well, it can be done:

int = (x^2 + 2 x + 1 + (3 x + 1) Sqrt[x + Log[x]]) /
(x Sqrt[x + Log[x]] (x + Sqrt[x + Log[x]]));
dy = (1 + x)/(x Sqrt[x + Log[x]]);

Integrate[int - dy, x] + Integrate[dy, x]
(*  2 Sqrt[x + Log[x]] + 2 Log[x + Sqrt[x + Log[x]]]  *)

• Wow! How did you determine dy? Were you looking for a term that would eliminate the x^2 in the numerator? – Chip Hurst Sep 29 '16 at 17:58
• @ChipHurst I thought u == x + Sqrt[x + Log[x]] was a rather "obvious" substitution to try. That led to a left-over part dy. -- I mentioned in a comment to the Q that I found this exact integral in an old notebook (with Kuba's DChange[]) a few minutes after posting this. It seems I was trying the same substitution with DChange[], but it failed. It appears I didn't figure it out back then. It was a surprise to find, since I was looking for DChange[] to try it out on this problem (again, apparently). – Michael E2 Sep 29 '16 at 18:19
• A nice counterexample to "if machines can't, humans can't". – anderstood Sep 29 '16 at 18:49
• Wow, nice. So may be Humans still have a fighting chance against machines when it comes to Mathematics. At least for few more years? :) – Nasser Sep 29 '16 at 19:06
• @ChipHurst In fact, I did figure it out last time, just not with DChange[]. – Michael E2 Sep 29 '16 at 20:09

1.So if you meet such situations again which I mean you can't get the result you want in MMA,try to solve the same problem in other alternatives such as Maxima,Wolfram Alpha to see if there is a same result first.

2.If there is an difference among these platforms,try to debug your calculation process to make sure if it's MMA's bug indeed by some tools.Rubi is effective in this example.

3.Maybe you should seek some ways to change the descriptions for your question in MMA or something.Just think widely.

4.If there is no result you want eventually,you should check the problem by maths definitions which I refer to the necessary and sufficient conditions of integrablity and the existence of the result expression by elementary functions.