how this simplification was done in the integral? I'm stuck at simplification
Here is the Integral ,
$$I=\int\frac{x^2+x+1}{\sqrt{x^2+2x+3}} \ dx$$
To solve this ,
First let's Substitute, we got
$$x^2+2x+3=t^2$$
$$\implies {x}=\sqrt{(t^2-2)}-1$$
$$\implies dx=\frac{t}{\sqrt{t^2-2}}dt$$
Putting this back into the Integral followed by some simplification we have,
$$I=\int\sqrt{t^{2}-2}+\frac{1}{\sqrt{t^{2}-2}}-1 dt$$
Here, how they did it or how they "put back integral " and simplified it ? please, can anybody explain it step by step ?
 A: Substitution is not the way to go here,
Write the integral as
$$=\int\sqrt{x^2+2x+3}dx-\int\frac{x+1}{\sqrt{x^2+2x+3}}dx-\int\frac{1}{\sqrt{x^2+2x+3}}dx$$
We have three types of integrals. The middle is a straightforward substitution.
The first can be done by parts,
$$\int\sqrt{x^2+2x+3}dx=x\sqrt{x^2+2x+3}-\int\frac{x^2+x}{\sqrt{x^2+2x+3}}dx$$
which gives,
$$2\int\sqrt{x^2+2x+3}dx=x\sqrt{x^2+2x+3}+\int\frac{x+3}{\sqrt{x^2+2x+3}}dx$$
and the final type,
$$\int\frac{1}{\sqrt{x^2+2x+3}}dx=\int\frac{1}{\sqrt{(x+1)^2+2}}dx$$ use a $$x+1=\sqrt{2}\sinh y$$ substitution.
A: If you let $x=\sqrt{t^2-2}-1,$ then $\mathrm{d}x=\frac{t}{\sqrt{t^2-2}}\,\mathrm{d}t,$ $x^2+2x+3=t^2,$ and $x^2+x+1=x^2+2x+3-x-2=t^2-\left(\sqrt{t^2-2}-1\right)-2=t^2-1-\sqrt{t^2-2}.$ Therefore, $$\int\frac{x^2+x+1}{\sqrt{x^2+2x+3}}\,\mathrm{d}x=\int\frac{t^2-1-\sqrt{t^2-2}}{\sqrt{t^2}}\frac{t}{\sqrt{t^2-2}}\,\mathrm{d}t=\int\frac{t^2-1-\sqrt{t^2-2}}{\sqrt{t^2-2}}\sqrt{t^2}\,\mathrm{d}t$$ $$=\int\frac{t^2-1}{\sqrt{t^2-2}}\sqrt{t^2}\,\mathrm{d}t-\int\sqrt{t^2}\,\mathrm{d}t=\int\sqrt{t^2-2}\sqrt{t^2}\,\mathrm{d}t+\int\frac1{\sqrt{t^2-2}}\sqrt{t^2}\,\mathrm{d}t-\int\sqrt{t^2}\,\mathrm{d}t=\int\sqrt{t^2-2}|t|\,\mathrm{d}t+\int\frac1{\sqrt{t^2-2}}|t|\,\mathrm{d}t-\int|t|\,\mathrm{d}t.$$
This is the correct way to do the substitution.
A: These are the key steps of the substitution:
$$
\frac{x^2+x+1}{\sqrt{x^2+2x+3}}dx=\frac{x^2+2x+3-x-2}{t}dx=
$$
$$
=\frac{t^2-1-\sqrt{t^2-2}}{t}\frac{t}{\sqrt{t^2-2}}dt=
$$
$$
=\left(\frac{t^2-2}{\sqrt{t^2-2}}+\frac{1}{\sqrt{t^2-2}}-1\right)dt =
$$
$$
\left(\sqrt{t^{2}-2}+\frac{1}{\sqrt{t^{2}-2}}-1\right) dt
$$
A: this simplification is not correct, let me do the simplification with this substitution.
$$t^{2}=x^{2}+2 x+3=x^{2}+2 x+1+2=(x+1)^{2}+2 \Rightarrow
\sqrt{t^{2}-2}-1=x.$$
$$\frac{t}{\sqrt{t^{2}-2}} d t=d x.$$
$$t^{2}=x^{2}+2 x+3=x^{2}+x+1+x+2 \Rightarrow
t^{2}-x-2=t^{2}-\sqrt{t^{2}-2}-1=x^{2}+x+1.$$
$$\displaystyle
I=\int \frac{x^{2}+x+1}{\sqrt{x^{2}+2 x+3}} d x=\int \frac{\left(t^{2}-\sqrt{t^{2}-2}-1\right) t}{t \sqrt{t^{2}-2}} d t=\int \left(\frac{t^{2}}{\sqrt{t^{2}-2}}+\frac{1}{\sqrt{t^{2}-2}}-1 \right) d t.
$$
But it is clear that.
$$\sqrt{t^{2}-2} \neq \frac{t^{2}}{\sqrt{t^{2}-2}}.$$
