Step 1: Concept
To find the integrating factor of a linear differential equation, we first write it in standard form: $\frac{dy}{dx} + P(x)y = Q(x)$. The integrating factor is $\text{I.F.} = e^{\int P(x) \, dx}$.
Step 2: Meaning
We divide the entire equation by $(1 + x^2)$ to isolate $\frac{dy}{dx}$ and identify the function $P(x)$.
Step 3: Analysis
Dividing by $(1 + x^2)$:
\[ \frac{dy}{dx} + \left(\frac{2x}{1 + x^2}\right)y = \frac{\cos x}{1 + x^2} \]
Thus, $P(x) = \frac{2x}{1 + x^2}$.
Now calculate the integrating factor:
\[ \text{I.F.} = e^{\int \frac{2x}{1 + x^2} \, dx} \]
Using $u$-substitution for the exponent integration ($\int \frac{f'(x)}{f(x)} \, dx = \ln|f(x)|$):
\[ \text{I.F.} = e^{\ln(1 + x^2)} = 1 + x^2 \]
Step 4: Conclusion
The integrating factor is $1 + x^2$, which corresponds to option (B).
Final Answer: (B)