Example. Find the general solution of the linear differential equation

$$
y^{\prime \prime}+y=x \sin x
$$
Solution.

1. We write the corresponding homogeneous equation

$$
y^{\prime \prime}+y=0
$$

and look for its solution in the form $y=e^{\lambda x}$, where $\lambda$ is an unknown number.

Substituting $y=e^{\lambda x}, y^{\prime}=\lambda e^{\lambda x}$, and $y^{\prime \prime}=\lambda^{2} e^{\lambda x}$ into equation (6) and canceling $e^{\lambda x}$, we obtain the characteristic equation

$$
\lambda^{2}+1=0
$$

2. The characteristic equation has two complex conjugate roots $\lambda_{1,2}= \pm i$.

We have the fundamental system of solutions

$$
y_{1}=\cos x, \quad y_{2}=\sin x
$$

and the general solution of the homogeneous equation (6)

$$
y_{\text {o.o. }}=C_{1} \cos x+C_{2} \sin x \text {. }
$$

3. We look for any particular solution of the non-homogeneous equation (5). In our case, the right-hand side of the non-homogeneous equation has the form (4) with $a=0, b=1, n=0, m=1$.

Since the characteristic equation has complex roots $a \pm i b= \pm i$ of multiplicity $s=1$ and $\max \{n, m\}=1$, we seek the particular solution in the form

$$
y_{\text {p.n. }}=x\left[\left(A_{1} x+A_{2}\right) \cos x+\left(B_{1} x+B_{2}\right) \sin x\right],
$$

where $A_{1}, A_{2}, B_{1}, B_{2}$ are unknown numbers (undetermined coefficients).

4. We find the undetermined coefficients by differentiating $y_{\text {p. } \text {. }}$ twice and substituting into equation (5).

Equating the coefficients of $\cos x$, $x \cos x$, $\sin x$, and $x \sin x$ in both sides of the equality, we obtain four equations

$$
\left\{\begin{aligned}
2 A_{1}+2 B_{2} & =0 \\
4 B_{1} & =0 \\
-2 A_{2}+2 B_{1} & =0 \\
-4 A_{1} & =1
\end{aligned}\right.
$$

from which we determine $A_{1}=-1 / 4, A_{2}=0, B_{1}=0, B_{2}=1 / 4$. Thus,

$$
y_{\text {p.n. }}=-\frac{x^{2}}{4} \cos x+\frac{x}{4} \sin x .
$$

By formula (1), we find the general solution of the non-homogeneous equation

$$
y=C_{1} \cos x+C_{2} \sin x-\frac{x^{2}}{4} \cos x+\frac{x}{4} \sin x
$$

Answer. $y=C_{1} \cos x+C_{2} \sin x-\frac{x^{2}}{4} \cos x+\frac{x}{4} \sin x$.

Conditions of the Problems. Find the general solutions of the differential equations.

1. $y^{\prime \prime}+y=\cos x$.
2. $y^{\prime \prime}+y^{\prime}-2 y=8 \sin 2 x$.
3. $y^{\prime \prime}-2 y^{\prime}+5 y=e^{x} \cos 2 x$.
4. $y^{\prime \prime}+y=3 \sin x$.
5. $y^{\prime \prime}+y=4 x \cos x$.
6. $y^{\prime \prime}-9 y=e^{3 x} \cos x$.
7. $y^{\prime \prime}-4 y=e^{2 x} \sin 2 x$.
8. $y^{\prime \prime}-2 y=2 x e^{x}(\cos x-\sin x)$.
9. $y^{\prime \prime}-y=2 \sin x-4 \cos x$.
10. $y^{\prime \prime}-6 y^{\prime}+25 y=2 \sin x+3 \cos x$.

Answers.

1. $y=C_{1} \cos x+C_{2} \sin x+\frac{x}{2} \sin x$.
2. $y=C_{1} e^{x}+C_{2} e^{-2 x}-\frac{2}{5}(3 \sin 2 x+\cos 2 x)$.
3. $y=\left(C_{1} \cos 2 x+C_{2} \sin 2 x\right) e^{x}+\frac{x}{4} e^{x} \sin 2 x$.
4. $y=C_{1} \cos x+C_{2} \sin x-\frac{3}{2} x \cos x$.
5. $y=C_{1} \cos x+C_{2} \sin x+x \cos x+x^{2} \sin x$.
6. $y=C_{1} e^{3 x}+C_{2} e^{-3 x}+\frac{1}{37} e^{3 x}(6 \sin x-\cos x)$.
7. $y=C_{1} e^{-2 x}+C_{2} e^{2 x}-\frac{e^{2 x}}{20}(\sin 2 x+2 \cos 2 x)$.
8. $y=C_{1} e^{-x \sqrt{2}}+C_{2} e^{x \sqrt{2}}+x e^{x} \sin x+e^{x} \cos x$.
9. $y=C_{1} e^{x}+C_{2} e^{-x}+2 \cos x-\sin x$.
10. $y=\left(C_{1} \cos 4 x+C_{2} \sin 4 x\right) e^{3 x}+\frac{1}{102}(14 \cos x+5 \sin x)$.

### 11.10. Principle of Superposition

Problem Statement. Find the general solution of the linear differential equation of $n$-th order with constant coefficients

$$
y^{(n)}+p_{1} y^{(n-1)}+\ldots+p_{n-1} y^{\prime}+p_{n} y=F(x)
$$

where $F(x)=f_{1}(x)+f_{2}(x)+\ldots+f_{k}(x)$.

## Plan of Solution.

Principle of Superposition. If the right-hand side of equation (1) is the sum of several functions

$$
F(x)=f_{1}(x)+f_{2}(x)+\ldots+f_{k}(x)
$$

and $Y_{i}(i=1,2, \ldots, k)$ is any particular solution of each equation

$$
y^{(n)}+p_{1} y^{(n-1)}+\ldots+p_{n-1} y^{\prime}+p_{n} y=f_{i}(x) \quad(i=1,2, \ldots, k)
$$

then, due to the linearity of equation (1), its general solution has the form

$$
y=y_{0}+Y_{1}+Y_{2}+\ldots+Y_{k}
$$

where $y_{0}$ is the general solution of the homogeneous equation

$$
y^{(n)}+p_{1} y^{(n-1)}+\ldots+p_{n-1} y^{\prime}+p_{n} y=0
$$

1. We find the fundamental system of solutions and the general solution $y_{0}$ of the homogeneous equation.
2. For each non-homogeneous equation (2) $(i=1,2, \ldots, k)$, we find a particular solution $Y_{i}$ (using, for example, the method of undetermined coefficients or the method of variation of parameters).

We write the answer in the form (3).