To solve the ordinary differential equation \( y'' + y = e^x \), we will use the method of undetermined coefficients. This ODE consists of a homogeneous part and a particular part.
-
Homogeneous Solution: First, let's find the solution to the associated homogeneous equation:
\[ y'' + y = 0 \]
The characteristic equation is:
\[ r^2 + 1 = 0 \]
Solving this gives:
\[ r = \pm i \]
Thus, the general solution to the homogeneous equation is:
\[ y_h = C_1 \cos(x) + C_2 \sin(x) \]
where \( C_1 \) and \( C_2 \) are constants.
-
Particular Solution: Now, we need to find a particular solution \( y_p \) for the non-homogeneous equation \( y'' + y = e^x \). We will use the method of undetermined coefficients, and we will try a solution in the form:
\[ y_p = A e^x \]
where \( A \) is a constant to be determined.
We calculate the first and second derivatives of \( y_p \):
\[ y_p' = A e^x \] \[ y_p'' = A e^x \]
Substitute \( y_p \) and its derivatives back into the original equation:
\[ y_p'' + y_p = A e^x + A e^x = 2A e^x \]
We want this to equal \( e^x \):
\[ 2A e^x = e^x \]
Dividing both sides by \( e^x \) (assuming \( e^x \neq 0 \)) gives:
\[ 2A = 1 \implies A = \frac{1}{2} \]
Therefore, the particular solution is:
\[ y_p = \frac{1}{2} e^x \]
-
General Solution: The general solution \( y \) to the original non-homogeneous equation is the sum of the homogeneous and particular solutions:
\[ y = y_h + y_p = C_1 \cos(x) + C_2 \sin(x) + \frac{1}{2} e^x \]
Thus, the final solution to the ordinary differential equation \( y'' + y = e^x \) is:
\[ \boxed{y = C_1 \cos(x) + C_2 \sin(x) + \frac{1}{2} e^x} \]
where \( C_1 \) and \( C_2 \) are arbitrary constants determined by initial or boundary conditions.