Answer :

To solve the integral [tex]\( \int \frac{\cos (x)}{\sin ^2(x)+1} \, d x \)[/tex], let's proceed step-by-step.

1. Substitution:
Notice that the denominator [tex]\(\sin^2(x) + 1\)[/tex] suggests that we can use the trigonometric identity:
[tex]\[ \sin^2(x) + 1 = (\sin(x))^2 + 1 \][/tex]
To simplify the integral, we can use a substitution. Let:
[tex]\[ u = \sin(x) \][/tex]
Then, the derivative of [tex]\(u\)[/tex] with respect to [tex]\(x\)[/tex] is:
[tex]\[ \frac{du}{dx} = \cos(x) \implies du = \cos(x) \, dx \][/tex]

2. Rewrite the Integral:
Substitute [tex]\(u\)[/tex] and [tex]\(du\)[/tex] into the integral:
[tex]\[ \int \frac{\cos (x)}{\sin ^2(x)+1} \, dx = \int \frac{\cos (x)}{u^2 + 1} \, dx \][/tex]
Since [tex]\(\cos(x) \, dx = du\)[/tex], we can further simplify the integral to:
[tex]\[ \int \frac{1}{u^2 + 1} \, du \][/tex]

3. Integrate:
The integral [tex]\( \int \frac{1}{u^2 + 1} \, du \)[/tex] is a standard integral which is known to be the arctangent function:
[tex]\[ \int \frac{1}{u^2 + 1} \, du = \arctan(u) + C \][/tex]
where [tex]\(C\)[/tex] is the constant of integration.

4. Back Substitution:
Recall that [tex]\(u = \sin(x)\)[/tex], so we substitute back [tex]\(u\)[/tex] into the result:
[tex]\[ \arctan(u) + C = \arctan(\sin(x)) + C \][/tex]

Thus, the integral
[tex]\[ \int \frac{\cos (x)}{\sin ^2(x)+1} \, d x = \arctan(\sin(x)) + C \][/tex]
where [tex]\(C\)[/tex] is the constant of integration.