Non-Homogeneous DEs
Cheatsheet Content
### Introduction to Non-Homogeneous Linear ODEs A second-order non-homogeneous linear ordinary differential equation with constant coefficients has the form: $$a y'' + b y' + c y = r(x)$$ where $a, b, c$ are constants and $r(x)$ is a non-zero function. The general solution is $y(x) = y_h(x) + y_p(x)$, where: - $y_h(x)$ is the general solution to the homogeneous equation $a y'' + b y' + c y = 0$. - $y_p(x)$ is a particular solution to the non-homogeneous equation. ### Homogeneous Solution ($y_h$) To find $y_h(x)$, solve the characteristic equation $a m^2 + b m + c = 0$. #### Cases for Roots: 1. **Distinct Real Roots ($m_1, m_2$):** $y_h = C_1 e^{m_1 x} + C_2 e^{m_2 x}$ 2. **Repeated Real Root ($m_1 = m_2 = m$):** $y_h = (C_1 + C_2 x) e^{m x}$ 3. **Complex Conjugate Roots ($m_{1,2} = \alpha \pm i\beta$):** $y_h = e^{\alpha x} (C_1 \cos(\beta x) + C_2 \sin(\beta x))$ ### Method of Undetermined Coefficients This method is suitable when $r(x)$ is a polynomial, exponential, sine/cosine, or a product/sum of these. We assume a form for $y_p$ based on $r(x)$ and determine the coefficients. #### Rules for $y_p$ Form: | $r(x)$ Type | Initial Guess for $y_p$ | |-------------|-------------------------| | $k e^{ax}$ | $A e^{ax}$ | | $k x^n$ | $A_n x^n + ... + A_1 x + A_0$ | | $k \cos(ax)$ or $k \sin(ax)$ | $A \cos(ax) + B \sin(ax)$ | #### Modification Rule: If any term in your initial guess for $y_p$ is part of $y_h$, multiply the guess by $x$ (or $x^2$ if the term is part of $y_h$ with a repeated root). #### Example: Solve $y'' - 3y' + 2y = 4e^{3x}$ 1. **Find $y_h$**: Characteristic equation $m^2 - 3m + 2 = 0 \implies (m-1)(m-2) = 0$. Roots are $m_1=1, m_2=2$. $y_h = C_1 e^x + C_2 e^{2x}$. 2. **Guess $y_p$**: $r(x) = 4e^{3x}$. Initial guess $y_p = A e^{3x}$. No term in $A e^{3x}$ is in $y_h$. So, this guess is fine. 3. **Find derivatives**: $y_p' = 3A e^{3x}$ $y_p'' = 9A e^{3x}$ 4. **Substitute into ODE**: $9A e^{3x} - 3(3A e^{3x}) + 2(A e^{3x}) = 4e^{3x}$ $9A e^{3x} - 9A e^{3x} + 2A e^{3x} = 4e^{3x}$ $2A e^{3x} = 4e^{3x} \implies 2A = 4 \implies A = 2$. 5. **Particular solution**: $y_p = 2e^{3x}$. 6. **General solution**: $y = y_h + y_p = C_1 e^x + C_2 e^{2x} + 2e^{3x}$. ### Method of Variation of Parameters This method is more general and works for any continuous $r(x)$. It requires finding $y_h$ first. Given $y_h = C_1 y_1(x) + C_2 y_2(x)$ for $a y'' + b y' + c y = r(x)$. The particular solution is $y_p = -y_1 \int \frac{y_2 r(x)}{a W(y_1, y_2)} dx + y_2 \int \frac{y_1 r(x)}{a W(y_1, y_2)} dx$. Where $W(y_1, y_2)$ is the Wronskian of $y_1$ and $y_2$: $$W(y_1, y_2) = \det \begin{pmatrix} y_1 & y_2 \\ y_1' & y_2' \end{pmatrix} = y_1 y_2' - y_2 y_1'$$ #### Example: Solve $y'' + y = \sec(x)$ 1. **Find $y_h$**: Characteristic equation $m^2 + 1 = 0 \implies m = \pm i$. $y_h = C_1 \cos(x) + C_2 \sin(x)$. So, $y_1 = \cos(x)$ and $y_2 = \sin(x)$. 2. **Calculate Wronskian**: $y_1' = -\sin(x)$, $y_2' = \cos(x)$. $W(\cos(x), \sin(x)) = (\cos(x))(\cos(x)) - (\sin(x))(-\sin(x)) = \cos^2(x) + \sin^2(x) = 1$. 3. **Identify $r(x)$ and $a$**: $r(x) = \sec(x)$, $a = 1$. 4. **Calculate integrals for $y_p$**: $\int \frac{y_2 r(x)}{a W} dx = \int \frac{\sin(x) \sec(x)}{1 \cdot 1} dx = \int \frac{\sin(x)}{\cos(x)} dx = \int \tan(x) dx = -\ln|\cos(x)|$. $\int \frac{y_1 r(x)}{a W} dx = \int \frac{\cos(x) \sec(x)}{1 \cdot 1} dx = \int 1 dx = x$. 5. **Form $y_p$**: $y_p = -y_1 (-\ln|\cos(x)|) + y_2 (x)$ $y_p = -(\cos(x))(-\ln|\cos(x)|) + (\sin(x))(x)$ $y_p = \cos(x) \ln|\cos(x)| + x \sin(x)$. 6. **General solution**: $y = C_1 \cos(x) + C_2 \sin(x) + \cos(x) \ln|\cos(x)| + x \sin(x)$. ### Euler-Cauchy Equations An Euler-Cauchy equation is a linear ODE of the form: $$ax^2 y'' + bxy' + cy = r(x)$$ where $a, b, c$ are constants. #### Homogeneous Solution ($r(x)=0$): Assume a solution of the form $y = x^m$. Substitute into the homogeneous equation: $ax^2 (m(m-1)x^{m-2}) + bx(mx^{m-1}) + c x^m = 0$ $a m(m-1)x^m + b m x^m + c x^m = 0$ $x^m [a m(m-1) + b m + c] = 0$ This gives the characteristic equation: $a m(m-1) + b m + c = 0 \implies a m^2 + (b-a)m + c = 0$. #### Cases for Roots: 1. **Distinct Real Roots ($m_1, m_2$):** $y_h = C_1 x^{m_1} + C_2 x^{m_2}$ 2. **Repeated Real Root ($m_1 = m_2 = m$):** $y_h = (C_1 + C_2 \ln|x|) x^m$ 3. **Complex Conjugate Roots ($m_{1,2} = \alpha \pm i\beta$):** $y_h = x^{\alpha} (C_1 \cos(\beta \ln|x|) + C_2 \sin(\beta \ln|x|))$ #### Non-Homogeneous Solution: For $r(x) \neq 0$, use the Method of Variation of Parameters after transforming the equation into standard form ($y'' + P(x)y' + Q(x)y = f(x)$) by dividing by $ax^2$. So, $y'' + \frac{b}{ax}y' + \frac{c}{ax^2}y = \frac{r(x)}{ax^2}$. Then $r_{new}(x) = \frac{r(x)}{ax^2}$. #### Example: Solve $x^2 y'' + 3xy' + y = \frac{1}{x}$ for $x>0$. 1. **Find $y_h$**: Characteristic equation $m(m-1) + 3m + 1 = 0$. $m^2 - m + 3m + 1 = 0 \implies m^2 + 2m + 1 = 0 \implies (m+1)^2 = 0$. Repeated root $m = -1$. $y_h = C_1 x^{-1} + C_2 x^{-1} \ln(x)$. So, $y_1 = x^{-1}$ and $y_2 = x^{-1} \ln(x)$. 2. **Transform to standard form**: Divide by $x^2$: $y'' + \frac{3}{x}y' + \frac{1}{x^2}y = \frac{1}{x^3}$. Now $a=1$ (for Variation of Parameters formula) and $r_{new}(x) = \frac{1}{x^3}$. 3. **Calculate Wronskian**: $y_1 = x^{-1} \implies y_1' = -x^{-2}$ $y_2 = x^{-1} \ln(x) \implies y_2' = -x^{-2} \ln(x) + x^{-1}(x^{-1}) = -x^{-2} \ln(x) + x^{-2}$ $W(y_1, y_2) = (x^{-1})(-x^{-2} \ln(x) + x^{-2}) - (x^{-1} \ln(x))(-x^{-2})$ $W = -x^{-3} \ln(x) + x^{-3} + x^{-3} \ln(x) = x^{-3}$. 4. **Calculate integrals for $y_p$**: $\int \frac{y_2 r_{new}(x)}{a W} dx = \int \frac{(x^{-1} \ln(x)) (x^{-3})}{1 \cdot x^{-3}} dx = \int x^{-1} \ln(x) dx$. (Use integration by parts: $u=\ln(x), dv=x^{-1}dx \implies du=x^{-1}dx, v=\ln(x)$) $= \ln^2(x) - \int \ln(x) x^{-1} dx \implies 2 \int x^{-1} \ln(x) dx = \ln^2(x) \implies \int x^{-1} \ln(x) dx = \frac{1}{2} \ln^2(x)$. $\int \frac{y_1 r_{new}(x)}{a W} dx = \int \frac{(x^{-1}) (x^{-3})}{1 \cdot x^{-3}} dx = \int x^{-1} dx = \ln(x)$. 5. **Form $y_p$**: $y_p = -y_1 (\frac{1}{2} \ln^2(x)) + y_2 (\ln(x))$ $y_p = -(x^{-1}) (\frac{1}{2} \ln^2(x)) + (x^{-1} \ln(x)) (\ln(x))$ $y_p = -\frac{1}{2} x^{-1} \ln^2(x) + x^{-1} \ln^2(x) = \frac{1}{2} x^{-1} \ln^2(x)$. 6. **General solution**: $y = C_1 x^{-1} + C_2 x^{-1} \ln(x) + \frac{1}{2} x^{-1} \ln^2(x)$.