Integral Substitution 368669
1. **State the problem:** We need to evaluate the integral $$\int \frac{x^2}{(x^2+1)(1+\sqrt{1+x^2})} \, dx.$$\n\n2. **Identify substitution:** Let us set $$t = \sqrt{1+x^2}.$$ Then $$t^2 = 1 + x^2 \implies x^2 = t^2 - 1.$$\n\n3. **Find differential:** Differentiating both sides, $$2t \, dt = 2x \, dx \implies x \, dx = t \, dt.$$\n\n4. **Rewrite the integral:** Substitute into the integral:\n$$\int \frac{x^2}{(x^2+1)(1+t)} \, dx = \int \frac{t^2 - 1}{(t^2)(1+t)} \, dx.$$\nBut we need to express $dx$ in terms of $dt$. From step 3, $$dx = \frac{t \, dt}{x}.$$\nSince $x = \sqrt{t^2 - 1}$, then\n$$dx = \frac{t}{\sqrt{t^2 - 1}} dt.$$\n\n5. **Rewrite the integral fully in $t$:**\n$$\int \frac{t^2 - 1}{t^2 (1+t)} \cdot \frac{t}{\sqrt{t^2 - 1}} dt = \int \frac{(t^2 - 1) t}{t^2 (1+t) \sqrt{t^2 - 1}} dt = \int \frac{\sqrt{t^2 - 1}}{1+t} dt.$$\n\n6. **Simplify the integral:** The integral reduces to\n$$\int \frac{\sqrt{t^2 - 1}}{1+t} dt.$$\n\n7. **Rationalize the denominator:** Multiply numerator and denominator by $1 - t$:\n$$\int \frac{\sqrt{t^2 - 1} (1 - t)}{(1+t)(1 - t)} dt = \int \frac{\sqrt{t^2 - 1} (1 - t)}{1 - t^2} dt = \int \frac{\sqrt{t^2 - 1} (1 - t)}{1 - t^2} dt.$$\nSince $1 - t^2 = -(t^2 - 1)$, rewrite denominator:\n$$= \int \frac{\sqrt{t^2 - 1} (1 - t)}{-(t^2 - 1)} dt = - \int \frac{1 - t}{\sqrt{t^2 - 1}} dt.$$\n\n8. **Split the integral:**\n$$- \int \frac{1}{\sqrt{t^2 - 1}} dt + \int \frac{t}{\sqrt{t^2 - 1}} dt.$$\n\n9. **Evaluate each integral:**\n- $$\int \frac{1}{\sqrt{t^2 - 1}} dt = \ln|t + \sqrt{t^2 - 1}| + C.$$\n- $$\int \frac{t}{\sqrt{t^2 - 1}} dt = \sqrt{t^2 - 1} + C.$$\n\n10. **Combine results:**\n$$- \ln|t + \sqrt{t^2 - 1}| + \sqrt{t^2 - 1} + C.$$\n\n11. **Back-substitute $t = \sqrt{1+x^2}$:**\n$$\boxed{\sqrt{1+x^2} - \ln\left|\sqrt{1+x^2} + x\right| + C}.$$\n\nThis is the final answer.