Differential Equation Exercise 8
We want to solve the following differential equation:
$$ y' + y \cdot \sin x = 0 $$
This is a first-order differential equation.
There are two straightforward methods to solve it.
Method 1
The equation is of the form y' + f(x)g(y) = 0, with f(x) = sin x and g(y) = y.
$$ y' + y \cdot \sin x = 0 $$
This makes it suitable for the separation of variables method.
Rewriting, we get:
$$ \frac{dy}{dx} = - y \cdot \sin x $$
Separating the variables:
$$ \frac{dy}{y} = - \sin x \, dx $$
Now integrate both sides with respect to their own variables:
$$ \int \frac{1}{y} \, dy = - \int \sin x \, dx $$
The integral on the right evaluates to -(-cos x) + c, or simply cos x + c:
$$ \int \frac{1}{y} \, dy = \cos x + c $$
The integral on the left is log y:
$$ \log y = \cos x + c $$
Exponentiating both sides gives:
$$ e^{\log y} = e^{\cos x + c} $$
Since the exponential and logarithm are inverse functions, we have:
$$ y = e^{\cos x} \cdot e^c $$
Here ec is just a constant, so we can write it simply as c:
The general solution is therefore:
$$ y = c \, e^{\cos x} $$
Method 2
This is also a first-order linear homogeneous equation of the form y' + a(x)·y = b(x), with a(x) = sin x and b(x) = 0.
$$ y' + y \cdot \sin x = 0 $$
We can solve it using the method of constant variation:
$$ y = e^{ - \int a(x) \, dx} \left[ \int b(x) \, e^{ \int a(x) \, dx } dx + c \right] $$
Substituting b(x) = 0 and a(x) = sin x:
$$ y = e^{ - \int \sin x \, dx} \left[ \int 0 \cdot e^{ \int \sin x \, dx } dx + c \right] $$
$$ y = e^{ - \int \sin x \, dx} \cdot c $$
The integral of sin x is -cos x, so:
$$ y = e^{ - (- \cos x) } \cdot c $$
Which simplifies to the general solution:
$$ y = c \, e^{\cos x} $$
As expected, both methods lead to the same result.
