# Background

MathJax TeX Test Page Before, we discussed nonhomogeneous equations, however they were always something a combination of $x^n$, $\sin(x)$, or $e^x$. What if we had a differential equation equal to $\tan(x)$? Luckily, variation of paramters can do this.

# Method

MathJax TeX Test Page This method is easier to derive with a second degree differential equation then generalize. Let's say we have this differential equation. $$y'' + Py' + Qy = f(x)$$ Note that there is no coefficient in front of the first term. This is crucial. Don't forget to divide through by the factor in front of the first term. So, the solution to the homogeneous equation is $c_1y_1 + c_2y_2$. The solution to the homogeneous equation is $y_p = u_1y_1 + u_2y_2$, where the $u$'s are functions. Imagine that f(x) = 0, $u_1$ and $u_2$ would also be 0, so it works out.

We want to figure out what the u's are, so we need two conditions. The first condition is $L(y_p) = f(x)$. We still need another, and we'll find a condition that simplifies our arithmetic. $$y_p = u_1y_1 + u_2y_2$$ $$y'_p = (u_1y'_1 + u'_1y_1) + (u_2y'_2 + u'_2y_2)$$ Here is where we get our second condition: $u'_1y_1 + u'_2y_2 = 0$. This will really simplify arithmetic. $$y''_p = (u_1y''_1 + u_2y''_2) + (u'_1y'_1 + u'_2y'_2)$$ Now, we go back to our original equation. $y'' + Py' + Qy = 0$. This works for any y. So, we rewrite $y''_p$. $$y''_p = (u_1y''_1 + u_2y''_2) + (u'_1y'_1 + u'_2y'_2)$$ $$y''_p = u_1(-Py'_1 - Qy_1) + u_2(-Py'_2 - Qy_2) + (u'_1y'_1 + u'_2y'_2)$$ $$y''_p = (u'_1y'_1 + u'_2y'_2) - P(u_1y'_1 + u_2y'_2) - Q(u_1y_1 + u_2y_2)$$ Finally, we can rewrite this one last time, noting that the terms multiplied by P and Q are $y_p$ and $y'_p$. $$y''_p = (u'_1y'_1 + u'_2y'_2) - Py'_p - Qy_p \to y''_p + Py'_p + Qy_p = u'_1y'_1 + u'_2y'_2 = f(x)$$ We have our two conditions: $$\boxed{u'_1y_1 + u'_2y_2 = 0}$$ $$\boxed{u'_1y'_1 + u'_2y'_2 = f(x)}$$

# General Case

MathJax TeX Test Page Instead of just two conditions, we now have n. $$u'_1y_1 + ... + u'_ny_n = 0$$ $$u'_1y'_1 + ... + u'_ny'_n = 0$$ $$...$$ $$u'_1y^{(n-1)}_1 + ... + u'_ny^{(n-1)}_n = 0$$ So, in this system of equations, $y_1 \to y_n$ are coefficients and we want know the $u$. Using linear algebra we can rewrite this into a Wronskian, with the variables inside being y's.

# Example

MathJax TeX Test Page $$x^3y^{(3)} + x^2y'' - 6xy' + 6y = 30x$$ Because this is in Euler-Cauchy form, we plug in $x^r$, and find out that the homogeneous equation has the solutions $x, x^3,$ and $x^{-2}$. In order to do variation of parameters, we must divide through by the first coefficient. $$y^{(3)} + \frac{1}{x}y'' - \frac{6}{x^2}y' + \frac{6}{x^3}y = \frac{30}{x^2}$$ Notice that we cannot use our old method of finding the derivative of the f(x) until it's 0. The degree of x is negative. We don't know how to do that. Here are our three equations: $$u'_1(x) + u'_2(x^3) + u'_3(x^{-2}) = 0$$ $$u'_1(1) + u'_2(3x^2) + u'_3(-2x^{-3}) = 0$$ $$u'_1(0) + u'_2(6x) + u'_3(6x^{-4}) = 30x^{-2}$$ This is equivalent to $$\begin{bmatrix}x & x^3 & x^{-2} \\ 1 & 3x^2 & -2x^{-3} \\ 0 & 6x & 6x^{-4}\end{bmatrix} \begin{bmatrix}u'_1 \\ u'_2 \\u'_3\end{bmatrix} = \begin{bmatrix}0\\0\\30x^{-2}\end{bmatrix}$$ This is an important note, as we will be reusing this many times. The determinant of that matrix is $\dfrac{30}{x}$. In order to solve this system of equations, we must use something called Cramer's rule. The rule (in this case) is this: $$u'_1 = \dfrac{\begin{vmatrix}0 & x^3 & x^{-2} \\ 0 & 3x^2 & -2x^{-3} \\ 30x^{-2} & 6x & 6x^{-4}\end{vmatrix}}{\frac{30}{x}} = \frac{-5}{x}$$ You replace the column you want to solve with the solution column. $$u'_2 = \dfrac{\begin{vmatrix}x & 0 & x^{-2} \\ 1 & 0 & -2x^{-3} \\ 0 & 30x^{-2} & 6x^{-4}\end{vmatrix}}{\frac{30}{x}} = \frac{3}{x^3}$$ $$u'_3 = \dfrac{\begin{vmatrix}x & x^3 & 0 \\ 1 & 3x^2 & 0 \\ 0 & 6x & 30x^{-2}\end{vmatrix}}{\frac{30}{x}} = 2x^2$$ Because all of the terms are derivatives, we must integrate. $$u_1 = -5\ln(x), u_2 = \dfrac{-3}{2x^2}, u_3 = \frac{2}{3}x^3$$ We finally get our particular solution. $$y_p = -5\ln(x)(x) + \dfrac{-3}{2x^2}(x^3) + \dfrac{2}{3}x^3(x^{-2}) = -\dfrac{5}{6}x - 5x\ln(x)$$ You may have noticed that there was an x term in the particular solution and the homogeneous solution. That doesn't mean you did anything wrong. When you get your full solution, that will be swallowed up by the constant. The entire solution for this different equation is $$y = c_1x + c_2x^3 + c_3x^{-2} - 5x\ln(x)$$