Initial Value Problem

Solution 1:

This is a linear constant coefficient differential equation, so the general solution has the form $y = y_{p} + y_{h},$ where $y_{p}$ is any particular solution to the differential equation and $y_{h}$ is the general solution to the corresponding homogenous differential equation.

An analogy I used to tell students: The $y_h$ part is just like including $+ \, C$ for indefinite integrals. For example, $\int x^2 \, dx \; = \; \frac{1}{3}x^{3} + C$ can be viewed as $y_{p} + y_{h},$ where $y_p = \frac{1}{3}x^3$ is any particular solution to $y' = x^2$ (i.e. any particular solution to the non-homogeneous differential equation) and $y_h$ is the general solution to $y' = 0$ (i.e. the general solution to the corresponding homogenous differential equation).

Finding $y_h$

Since this is a constant coefficient differential equation, we can substitute $y = e^{rx}$ and obtain an algebraic equation for $r.$ $$y = e^{rx} \;\;\;\; \text{and} \;\;\;\; y' = re^{rx} \;\;\;\; \text{and} \;\;\;\; y'' = r^2e^{rx} $$ $$ y'' \; - \; 3y' \; + \; 2y \; = \; 0 $$ $$ r^2e^{rx} \; - \; 3re^{rx} \; + \; 2e^{rx} \; = \; 0 $$ $$ e^{rx}(r^2 - 3r + 2) \; = \; 0 $$ Recall that the exponential is never zero, even for complex values of $r.$ [More mathematically sophisticated readers may find my 30 January 2006 sci.math post Is e^x zero in some extended number system? (follow-up post) of some interest.] Therefore, we conclude that $$ r^2 - 3r + 2 = 0$$ $$(r-1)(r-2) = 0$$ $$r \; = \; 1, \, 2$$ Thus, we are led to $$y_h \; = \; C_{1}e^x + C_{2}e^{2x}$$

Finding $y_p$

I will use the method of undetermined coefficients. The non-homogeneous terms are $3e^{-x}$ and $-10 \cos {3x},$ so we begin our "guess" with $Ae^{-x} + B\cos{3x} + C\sin{3x}.$ Since no nonzero homogeneous solution can equal this (a linear algebra issue that basically comes down to the fact that $\{e^{-x}, \; \cos {3x}, \; \sin{3x}, \; e^{x}, \; e^{2x} \}$ is linearly independent, which can be verified by computing an appropriate Wronskian determinant if you had to verify this, but you probably don't have to), this initial "guess" for the form of $y_p$ winds up being the final form for $y_{p}.$ We need to plug this form for $y_p$ into the differential equation and solve for $A,$ $B,$ and $C.$ To this end, we begin by computing the first and second derivatives of $y_p$ and then we plug the result into the differential equation. $$y_p \;\; = \;\; Ae^{-x} + B\cos{3x} + C\sin{3x} $$ $$y'_p \;\; = \;\; -Ae^{-x} - 3B\sin{3x} + 3C\cos{3x} $$ $$y''_p \;\; = \;\; Ae^{-x} - 9B\cos{3x} - 9C\sin{3x} $$ Now that we have the derivatives, we plug into the differential equation (first equation below, for convenience). $$ y'' \; - \; 3y' \; + \; 2y \;\; = \;\; 3e^{-x} \; - \; 10 \cos {3x} $$ $$ \left(Ae^{-x} - 9B\cos{3x} - 9C\sin{3x} \right) \;\; - \;\; 3\left(-Ae^{-x} - 3B\sin{3x} + 3C\cos{3x} \right) \;\; + \;\; 2 \left(Ae^{-x} + B\cos{3x} + C\sin{3x} \right) \;\;\; = \;\;\; 3e^{-x} \; - \; 10 \cos {3x} $$ Regroup so that the coefficients of the functions are easier to identify. $$ (A + 3A + 2A)e^{-x} \; + \; (-9B - 9C + 2B)\cos{3x} \; + \; (-9C + 9B + 2C)\sin{3x} $$ $$ = \; 3e^{-x} \; - \; 10 \cos {3x} $$ $$ 6Ae^{-x} \; + \; (-7B - 9C)\cos{3x} \; + \; (9B - 7C)\sin{3x} \;\; = \;\; 3e^{-x} \; - \; 10 \cos {3x} $$ Using linear independence of the set $\{e^{-x}, \; \cos {3x}, \; \sin{3x} \},$ we get $$6A = 3 \;\;\;\; \text{and} \;\;\;\; -7B - 9C = -10 \;\;\;\; \text{and} \;\;\;\; 9B - 7C = 0$$ $$\begin{align} A \; &= \; \frac{1}{2} \\ -7B \; - \; 9C \; &= \; -10 \\ 9B \; - \; 7C \; &= \; 0 \end{align}$$ To solve for $B$ and $C,$ multiply the 2nd equation by $-7$ and the 3rd equation by $9,$ and then add the resulting equations: $$\begin{align} 49B \; + \; 63C \; &= \; 70 \\ 81B \; - \; 63C \; &= \; 0 \end{align}$$ $$130B \; = \; 70 \;\;\; \implies \;\;\; B \; = \; \frac{7}{13} $$ Now use $\;7C = 9B\;$ (a rewrite of 3rd equation) to find $C$: $$ 7C \; = \; 9B \; = \; 9 \cdot \frac{7}{13} \;\;\; \implies \;\;\; C \; = \; 9 \cdot \frac{1}{13} \; = \; \frac{9}{13} $$ To summarize, we have $$A = \frac{1}{2} \;\;\;\; \text{and} \;\;\;\; B = \frac{7}{13} \;\;\;\; \text{and} \;\;\;\; C = \frac{9}{13}$$ Therefore, $$y_p \;\; = \;\; \frac{1}{2}e^{-x} \; + \; \frac{7}{13}\cos{3x} \; + \; \frac{9}{13}\sin{3x} $$ and hence from $y = y_p + y_h$ we get $$ y \;\; = \;\; \frac{1}{2}e^{-x} \; + \; \frac{7}{13}\cos{3x} \; + \; \frac{9}{13}\sin{3x} \; + \; C_{1}e^x \; + \; C_{2}e^{2x} $$

Important Note

Before investing the time and effort in using $y(0) = 1$ and $y'(0) = 2$ to solve for the constants $C_1$ and $C_{2},$ it is worth spending a few moments checking on scrap paper that what we found for $y_p$ actually satisfies the differential equation. I did this, but it's a little tedious to type up, so I decided to write this note instead.

Finding the Constants

Applying the initial condition $y(0) = 1$ gives $$ \frac{1}{2}\left(1\right) \; + \; \frac{7}{13}\left(1\right) \; + \; \frac{9}{13}\left(0\right) \; + \; C_{1}(1) \; + \; C_{2}(1) \;\; = \;\; 1 $$ $$ C_1 \; + \; C_2 \;\; = \;\; 1 \; - \; \frac{1}{2} \; - \; \frac{7}{13} \;\; = \;\; \frac{26}{26} \; - \; \frac{13}{26} \; - \; \frac{14}{26} \;\; = \;\; -\frac{1}{26} $$ To apply the initial condition $y'(0) = 2,$ we first need to evaluate $y'.$ $$ y' \;\; = \;\; -\frac{1}{2}e^{-x} \; - \; \frac{21}{13}\sin{3x} \; + \; \frac{27}{13}\cos{3x} \; + \; C_{1}e^x \; + \; 2C_{2}e^{2x} $$ Using this we can now apply the initial condition $y'(0) = 2,$ which gives $$ -\frac{1}{2}\left(1\right) \; - \; \frac{21}{13}\left(0\right) \; + \; \frac{27}{13}\left(1\right) \; + \; C_{1}(1) \; + \; 2C_{2}(1) \;\; = \;\; 2 $$ $$ C_1 \; + \; 2C_2 \;\; = \;\; 2 \; + \; \frac{1}{2} \; - \; \frac{27}{13} \;\; = \;\; \frac{52}{26} \; + \; \frac{13}{26} \; - \; \frac{54}{26} \;\; = \;\; \frac{11}{26} $$ We now solve the following two equations, obtained above, to determine the values of the two constants. $$\begin{align} C_1 \; + \; C_2 \; &= \; -\frac{1}{26} \\ C_1 \; + \; 2C_2 \; &= \; \frac{11}{26}\end{align}$$ Subtracting the 1st equation from the second equation gives $$C_2 \; = \; \frac{11}{26} \; - \; \left(-\frac{1}{26}\right) \; = \; \frac{12}{26} \; = \; \frac{6}{13} $$ Now plug this value for $C_2$ into $ C_1 + C_2 = -\frac{1}{26}$ (the first equation) to get $C_{1}.$ $$C_1 \; = \; -C_2 \; - \; \frac{1}{26} \; = \; -\frac{6}{13} \; - \; \frac{1}{26} \; = \; -\frac{12}{26} \; - \; \frac{1}{26} \; = \; -\frac{13}{26} \; = \; -\frac{1}{2}$$

Solution to the Initial Value Problem

$$ y \;\; = \;\; \frac{1}{2}e^{-x} \; + \; \frac{7}{13}\cos{3x} \; + \; \frac{9}{13}\sin{3x} \; - \; \frac{1}{2}e^x \; + \; \frac{6}{13}e^{2x} $$

Safety Check for Values of Constants

I'll include the final check, that $y(0) = 1$ and $y'(0) = 2,$ since the details are not all that lengthy. $$ y(0) \;\; = \;\; \frac{1}{2}(1) \; + \; \frac{7}{13}(1) \; + \; \frac{9}{13}(0) \; - \; \frac{1}{2}(1) \; + \; \frac{6}{13}(1) \;\; = \;\; \frac{7+6}{13} \;\; = \;\; 1 $$ $$ y' \;\; = \;\; -\frac{1}{2}e^{-x} \; - \; \frac{21}{13}\sin{3x} \; + \; \frac{27}{13}\cos{3x} \; - \; \frac{1}{2}e^x \; + \; \frac{12}{13}e^{2x} $$ $$ y'(0) \;\; = \;\; -\frac{1}{2}(1) \; - \; \frac{21}{13}(0) \; + \; \frac{27}{13}(1) \; - \; \frac{1}{2}(1) \; + \; \frac{12}{13}(1) $$ $$= \;\; \left(-\frac{1}{2} - \frac{1}{2}\right) \; + \; \frac{27+12}{13} \;\; = \;\; -1 \; + \; 3 \;\; = \;\; 2 $$