Example 2.
\(\ \ \)
\begin{equation*}
2y' - 4\sin x = 2, \quad y(0) = 5 \text{.}
\end{equation*}
Solution. Solution
Start by isolating the derivative, \(y'\text{,}\) on one side of the equation
\begin{align*}
y' \amp = 1 + 2 \sin x
\end{align*}
Integrate both sides with respect to \(x\) to leave us with \(y\) on the left side
\begin{align*}
\int y'\ dx \amp = \int \left(1 + 2 \sin x\right) \ dx \\
y + c_1 \amp = x - 2 \cos x + c_2 \\
y \amp = x - 2 \cos x + \boxed{c_2 - c_1}\leftarrow c \\
y(x) \amp = x - 2 \cos x + c
\end{align*}
Finally, apply the initial condition \(y(0) = 5\) to find \(c\)
\begin{align*}
y(0) \amp = 5 \\
(0) - 2 \cos(0) + c \amp = 5 \\
0 - 2 + c \amp = 5 \\
c \amp = 7
\end{align*}
Thus, the solution to the differential equation is \(\quad y = x - 2 \cos x + 7 \text{.}\)