Differential Equation - Exercise 14
Consider the first-order differential equation:
$$ y' + x y + x = 0 $$
We can rewrite it in the standard linear form \( y' + a(x) y = b(x) \) with \( a(x) = x \) and \( b(x) = -x \):
$$ y' + x y = -x $$
Since this is a first-order linear differential equation, we can solve it using the method of variation of constants (also known as the integrating factor method).
The general solution formula is:
$$ y = e^{-\int a(x) \, dx} \left[ \int b(x) \, e^{\int a(x) \, dx} \, dx + C \right] $$
Substituting \( a(x) = x \) and \( b(x) = -x \):
$$ y = e^{-\int x \, dx} \left[ \int -x \, e^{\int x \, dx} \, dx + C \right] $$
Since \( \int x \, dx = \frac{x^2}{2} \), this becomes:
$$ y = e^{-\frac{x^2}{2}} \left[ -\int x \, e^{\frac{x^2}{2}} \, dx + C \right] $$
The integral \( \int x \, e^{\frac{x^2}{2}} dx \) is straightforward: its antiderivative is \( e^{\frac{x^2}{2}} \), because
Check: \( \frac{d}{dx} \left[ e^{\frac{x^2}{2}} \right] = e^{\frac{x^2}{2}} \cdot \frac{d}{dx} \left[ \frac{x^2}{2} \right] = e^{\frac{x^2}{2}} \cdot x \)
Substituting this result gives:
$$ y = e^{-\frac{x^2}{2}} \left[ - e^{\frac{x^2}{2}} + C \right] $$
Multiplying through by \( e^{-\frac{x^2}{2}} \):
$$ y = - e^{-\frac{x^2}{2}} \cdot e^{\frac{x^2}{2}} + C \, e^{-\frac{x^2}{2}} $$
$$ y = -1 + C \, e^{-\frac{x^2}{2}} $$
Thus, the general solution is:
$$ y = C \, e^{-\frac{x^2}{2}} - 1 $$
The two solution methods - direct integration and the integrating factor approach - lead to the same result, confirming its correctness.
