Integral $\int{\frac{1}{\sqrt{2x^2+x+1}}}dx$

I am trying to solve this integral but I can not figure what I do wrong.

$$I=\int{\frac{1}{\sqrt{(2x^2+x+1)}}}dx$$

Here's how I go about it: I think that maybe it can be solved following the $$\int{\frac{1}{\sqrt{\color{red}{x}^2+\color{blue}{a}^2}}}dx=\ln\left(x+\sqrt{x^2+a^2}\right)$$ I turn the denominator into a sum of 2 products: $$2x^2+x+1=\left(x\sqrt{2}+\frac{1}{2\sqrt{2}}\right)^2+\left(\frac{\sqrt{7}}{2\sqrt{2}}\right)^2$$ and "$$\color{red}{x}$$" from the formula would be "$$\left(x\sqrt{2}+\frac{1}{2\sqrt{2}}\right)$$" while "$$\color{blue}a$$" would be "$$\left(\frac{\sqrt{7}}{2\sqrt{2}}\right)$$ also "$$x^2+a^2$$" is the denominator "$$2x^2+x+1$$".

When I plug in these numbers I get the following result:
$$I=\ln\left(\left(x\sqrt{2}+\frac{1}{2\sqrt{2}}\right)+{\sqrt{2x^2+x+1}}\right)$$

I sometimes check my results using an online integral calculator and for this one it shows a different result:$$\frac{\ln\left(\sqrt{\frac{(4x+1)^2}{7}+1}+\frac{4x+1}{\sqrt{7}}\right)}{\sqrt{2}}$$

I am sorry if the formatting is not quite right, It's the best I can do and it took me about an hour aswell. $$\ddot \frown$$

• You will need to divide your expected answer by the coefficient of the $x$ you had (which is $\sqrt{2}$). If you cannot see why, you can try making a substitution $u = \sqrt{2}x + \frac{1}{2\sqrt{2}}$ in $I = \int\frac{1}{\sqrt{\left(\sqrt{2}x + \frac{1}{2\sqrt{2}}\right)^2 + a^2}}\, dx$. – Minus One-Twelfth Feb 14 at 13:31
• @MinusOne-Twelfth I see it now, It would have been a lot easier if I just made a substitution like that, I can't believe I did not see it. The answer would still be different anyway, right? – Radu Gabriel Feb 14 at 13:36
• Try and check whether the logarithm of the answer differs from yours just by a constant (try and factor things out of the answer's logarithm to manipulate it into your logarithm, and use log laws where appropriate). If so, then the answers would both be valid. – Minus One-Twelfth Feb 14 at 13:58

Second edit:

On my second thought, I found that there is a rather intuitive way to look at the reason why you must factor out the coefficient of $$x$$. As you say, if you treat "$$x$$" as $$(x\sqrt2 + \frac{1}{2\sqrt2})$$, "$$dx$$" would then become $$\sqrt2dx$$ instead of $$dx$$ only. So if you substitute the numbers including $$\sqrt2x$$ into the formula, what you would get is actually $$\sqrt2$$ times the original integral. Thus you need to divide your answer by $$\sqrt2$$ to make it right. Does this explanation makes sense?

First edit:

I forgot what the proof is, but the condition of using that formula that you stated at the start is that the co-efficient of $$x$$ must be 1. So what you need to do at the start, is to factor out the $$1/\sqrt2$$, instead of forming the sum of two squares straightaway. Probably someone else could answer you why that condition I mentioned holds true.