How should I find the nontrivial solution to this differential equation using the method of undetermined coefficients

ordinary differential equationssolution-verification

Find the nontrivial solution of this differential equation $x^2\frac{d^2y}{dx^2}+3x\frac{dy}{dx}+5y=8x, y(1)=2, y(exp(\pi/4))=2sinh(\pi/4).$

Here's my work:

Consider the differential equation $x^2\frac{d^2y}{dx^2}+3x\frac{dy}{dx}+5y=8x, y(1)=2, y(exp(\pi/4))=2sinh(\pi/4).$

The corresponding homogeneous equation is $x^2\frac{d^2y}{dx^2}+3x\frac{dy}{dx}+5y=0.$

Its characteristic equation is $r(r-1)+3r+5=0,$ so $r=-1\pm 2i.$

Now we have $y_{h}(x)=e^{-x}(c_{1}cos(2x)+c_{2}sin(2x)).$

Note that $y_{p}=Ax+B, y_{p}'=A, y_{p}''=0.$

Observe that $x^{2}y_{p}''+3xy_{p}'+5y_{p}=8x$

$x^2(0)+3x(A)+5(Ax+B)=8x$

$3Ax+5Ax+5B=8x$

$8Ax+5B=8x.$

Since $A=1, B=0,$ it follows that $y_{p}=x.$

Thus $y(x)=y_{h}(x)+y_{p}=e^{-x}(c_{1}cos(2x)+c_{2}sin(2x))+x.$

By our boundary conditions, we have that $y(1)=2\implies 2=e^{-1}(c_{1}cos(2)+c_{2}sin(2))+1,$ so $c_{1}cos(2)+c_{2}sin(2)=e.$

Then, $y(e^{\pi/4})=2sinh(\pi/4)\implies 2sinh(\pi/4)=e^{-e^{\pi/4}}(c_{1}cos(2e^{\pi/4})+c_{2}sin(2e^{\pi/4}))+e^{\pi/4}.$

Now I'm stuck. How should I proceed from here and find $c_{1}, c_{2}?$ What's the correct answer?

Best Answer

$$ x^{2} y^{\prime \prime}+3 y^{\prime} x +5 y-8 x=0 $$ With initial conditions \begin{align*} y \left(1\right) &= 2\\ y \left({\mathrm e}^{\frac{\pi}{4}}\right) &= 2 \sinh \left(\frac{\pi}{4}\right) \end{align*} This is second order non-homogeneous ODE. Let the solution be $$ y = y_h + y_p $$ Solving for $y_h$ from $$ x^{2} y^{\prime \prime}+3 y^{\prime} x +5 y = 0 $$ This is Euler second order ODE. Let the solution be $y = x^r$, then $y'=r x^{r-1}$ and $y''=r(r-1) x^{r-2}$. Substituting these back into the given ODE gives
$$ x^{2}(r(r-1))x^{r-2}+3 x r x^{r-1}+5 x^{r} = 0 $$ Simplifying gives $$ r \left(r -1\right)x^{r}+3 r\,x^{r}+5 x^{r} = 0 $$ Since $x^{r}\neq 0$ then dividing throughout by $x^{r}$ gives $$ r \left(r -1\right)+3 r+5 = 0 $$ Or $$ r^{2}+2 r +5 = 0 \tag{1} $$ Equation (1) is the characteristic equation. Its roots determine the form of the general solution. Using the quadratic equation the roots are \begin{align*} r_1 &= -1-2 i\\ r_2 &= -1+2 i \end{align*} The roots are complex conjugate of each others. Let the roots be \begin{align*} r_1 &= \alpha + i \beta \\ r_2 &= \alpha - i \beta \\ \end{align*} Where in this case $\alpha=-1$ and $\beta=-2$. Hence the solution becomes \begin{align*} y &= c_1 x^{r_1} + c_2 x^{r_2} \\ &= c_1 x^{\alpha + i \beta} + c_2 x^{\alpha - i \beta} \\ &= x^{\alpha} \left( c_1 x^{i \beta} + c_2 x^{- i \beta}\right) \\ &= x^{\alpha} \left( c_1 e^{\ln\left(x^{i \beta}\right)} + c_2 e^{\ln\left(x^{-i \beta}\right)}\right) \\ &= x^{\alpha} \left( c_1 e^{i \left(\beta \ln{x}\right)} + c_2 e^{-i \left(\beta \ln{x}\right)}\right) \end{align*} Using the values for $\alpha=-1, \beta=-2$, the above becomes \begin{align*} y&= x^{-1} \left( c_1 e^{-2 i \ln \left(x \right)} + c_2 e^{2 i \ln \left(x \right)} \right) \end{align*} Using Euler relation, the expression $c_1 e^{i A}+ c_2 e^{-i A}$ is transformed to $ c_1 \cos A+ c_2 \sin A$ where the constants are free to change. Applying this to the above result gives \begin{align*} y&=\frac{1}{x}\left(c_{1} \cos \left(2 \ln \left(x \right)\right)+c_{2} \sin \left(2 \ln \left(x \right)\right)\right) \end{align*} Next, we find the particular solution to the ODE $$ x^{2} y^{\prime \prime}+3 y^{\prime} x +5 y = 8 x $$ The method of variation of parameters will be used as it is more general and can be used when the coefficients of the ODE depend on $x$ as well. Let $$ y_p(x) = u_1 y_1 + u_2 y_2 $$ Where $u_1,u_2$ to be determined, and $y_1,y_2$ are the two basis solutions (the two linearly independent solutions of the homogeneous ODE) found earlier when solving the homogeneous ODE as \begin{align*} y_1 &= \frac{\cos \left(2 \ln \left(x \right)\right)}{x}\\ y_2 &= -\frac{\sin \left(2 \ln \left(x \right)\right)}{x} \end{align*} In the Variation of parameters $u_1,u_2$ are found using \begin{align*} u_1 &= -\int \frac{y_2 f(x)}{a W(x)} u_2 &= \int \frac{y_1 f(x)}{a W(x)} \end{align*} Where $W(x)$ is the Wronskian and $a$ is the coefficient in front of $y''$ in the given ODE. The Wronskian is given by $W= \begin{vmatrix} y_1 & y_{2} \\ y_{1}^{\prime} & y_{2}^{\prime} \end{vmatrix} $. Hence $$ W = \begin{vmatrix} \frac{\cos \left(2 \ln \left(x \right)\right)}{x} & -\frac{\sin \left(2 \ln \left(x \right)\right)}{x} \\ \frac{d}{dx}\left(\frac{\cos \left(2 \ln \left(x \right)\right)}{x}\right) & \frac{d}{dx}\left(-\frac{\sin \left(2 \ln \left(x \right)\right)}{x}\right) \end{vmatrix} $$ Which gives $$ W = \begin{vmatrix} \frac{\cos \left(2 \ln \left(x \right)\right)}{x} & -\frac{\sin \left(2 \ln \left(x \right)\right)}{x} \\ -\frac{\cos \left(2 \ln \left(x \right)\right)}{x^{2}}-\frac{2 \sin \left(2 \ln \left(x \right)\right)}{x^{2}} & \frac{\sin \left(2 \ln \left(x \right)\right)}{x^{2}}-\frac{2 \cos \left(2 \ln \left(x \right)\right)}{x^{2}} \end{vmatrix} $$ Therefore \begin{align*} W &= \left(\frac{\cos \left(2 \ln \left(x \right)\right)}{x}\right)\left(\frac{\sin \left(2 \ln \left(x \right)\right)}{x^{2}}-\frac{2 \cos \left(2 \ln \left(x \right)\right)}{x^{2}}\right) - \left(-\frac{\sin \left(2 \ln \left(x \right)\right)}{x}\right)\left(-\frac{\cos \left(2 \ln \left(x \right)\right)}{x^{2}}-\frac{2 \sin \left(2 \ln \left(x \right)\right)}{x^{2}}\right) \end{align*} Which simplifies to \begin{align*} W &= -\frac{2 \left(\cos \left(2 \ln \left(x \right)\right)^{2}+\sin \left(2 \ln \left(x \right)\right)^{2}\right)}{x^{3}} \end{align*} Which simplifies to $$ W = -\frac{2}{x^{3}} $$ Therefore \begin{align*} u_1 &= -\int \frac{-8 \sin \left(2 \ln \left(x \right)\right)}{-\frac{2}{x}}\,dx\\ &= - \int 4 x \sin \left(2 \ln \left(x \right)\right)d x\\ &= -\frac{x^{2} \tan \left(\ln \left(x \right)\right)^{2}-x^{2}+2 x^{2} \tan \left(\ln \left(x \right)\right)}{1+\tan \left(\ln \left(x \right)\right)^{2}}\\ &= \left(2 \cos \left(\ln \left(x \right)\right)^{2}-2 \sin \left(\ln \left(x \right)\right) \cos \left(\ln \left(x \right)\right)-1\right) x^{2} \end{align*} And \begin{align*} u_2 &= \int \frac{8 \cos \left(2 \ln \left(x \right)\right)}{-\frac{2}{x}}\,dx\\ &= \int -4 x \cos \left(2 \ln \left(x \right)\right)d x\\ &= \frac{x^{2} \tan \left(\ln \left(x \right)\right)^{2}-x^{2}-2 x^{2} \tan \left(\ln \left(x \right)\right)}{1+\tan \left(\ln \left(x \right)\right)^{2}}\\ &= -2 \left(\cos \left(\ln \left(x \right)\right)^{2}+\sin \left(\ln \left(x \right)\right) \cos \left(\ln \left(x \right)\right)-\frac{1}{2}\right) x^{2} \end{align*}

Therefore the particular solution, from equation (1) is \begin{align*} y_p(x) &= \left(2 \cos \left(\ln \left(x \right)\right)^{2}-2 \sin \left(\ln \left(x \right)\right) \cos \left(\ln \left(x \right)\right)-1\right) x \cos \left(2 \ln \left(x \right)\right)+2 \left(\cos \left(\ln \left(x \right)\right)^{2}+\sin \left(\ln \left(x \right)\right) \cos \left(\ln \left(x \right)\right)-\frac{1}{2}\right) x \sin \left(2 \ln \left(x \right)\right)\\ &= x \end{align*} Therefore the general solution is \begin{align*} y &= y_h + y_p \\ &= \frac{c_{1} \cos \left(2 \ln \left(x \right)\right)+c_{2} \sin \left(2 \ln \left(x \right)\right)+x^{2}}{x} \end{align*} Initial conditions are used to solve for the constants of integration. Looking at the above solution \begin{align*} y = \frac{c_{1} \cos \left(2 \ln \left(x \right)\right)+c_{2} \sin \left(2 \ln \left(x \right)\right)+x^{2}}{x} \tag{1} \end{align*} Initial conditions are now substituted in the above solution. This will generate the required equations to solve for the integration constants. substituting $y = 2 \sinh \left(\frac{\pi}{4}\right)$ and $x = {\mathrm e}^{\frac{\pi}{4}}$ in the above gives \begin{align*} 2 \sinh \left(\frac{\pi}{4}\right) = {\mathrm e}^{\frac{\pi}{4}}+{\mathrm e}^{-\frac{\pi}{4}} c_{2}\tag{1A} \end{align*} substituting $y = 2$ and $x = 1$ in (1) gives \begin{align*} 2 = c_{1} +1\tag{2A} \end{align*} Equations (1A,2A) are solved for $\{c_{1}, c_{2}\}$. Solving for the constants gives \begin{align*} c_{1}&=1\\ c_{2}&=-1 \end{align*} Substituting these values back in above solution results in \begin{align*} y = \frac{\cos \left(2 \ln \left(x \right)\right)-\sin \left(2 \ln \left(x \right)\right)+x^{2}}{x} \end{align*}

Related Question