<html>
<p><img src="https://s14.postimg.org/keqhzwtmp/exercises.jpg" width="500" height="500"/></p>
<p> Hello it's a me again drifter1! Today we will get into <strong>Mathematics </strong>again to do some <strong>2nd-order ODE exercises</strong>. I will get into the different cases of problems that you can get and solve them step by step and very precisely, so that you understand my way of thinking.</p>
<p>So, without further do, let's get straight into it!</p>
<h2>Actually 1st-order case</h2>
<p> When a 2nd-order ODE doesn't contain y = y(x) then we substitute u = y' and get a 1st-order ODE that will be of one of the types we discussed previously in my series.</p>
<p><a href="https://steemit.com/mathematics/@drifter1/mathematics-first-order-differential-equation-exercises">Here </a>you can find exercises for all the cases.</p>
<p>So, let's try solving one!</p>
<p><br></p>
<p><em>xy" + y' + x(y')^2 = 0</em> (non-linear second-order ODE)</p>
<p>We can clearly see that y = y(x) is missing and so we substitute using u = y'.</p>
<p>xu' + u + xu^2 = 0</p>
<p>Let's divide with x!=0 to find the type:</p>
<p>u' + (1/x)* u + u^2 = 0 [Bernoulli ODE]</p>
<p>Because it's a Bernoulli form we substitute z = u^(-1) = 1/u and so:</p>
<p>z' = (1/u)' = -(1/u^2)*u'.</p>
<p>Let's put u' from the Bernoulli equation:</p>
<p>z' = -(1/u^2)*[-(1/x)*u - u^2].</p>
<p>By changing 1/u with z we then get:</p>
<p>z' = -z^2*[-(1/x)*1/z - 1/z^2] =></p>
<p>z' = 1 - z/x =></p>
<p>z' - (1/x)*z = 1 [Linear ODE]</p>
<p>So, we again have to subsitute z = gZ to solve the linear one!</p>
<p>g = e^(-integral(Pdx)) = e^(-integral(-1/x)dx) = e^lnx = x</p>
<p>Z = integral(Q/g)dx=></p>
<p>Z = integral(1/x)dx = lnx + c</p>
<p>And so z = x*lnx + xc.</p>
<p>That way:</p>
<p>u = 1/z = 1/(xlnx +xc)</p>
<p>y = integral(u) =></p>
<p><strong>y = integral[1/(xlnx + xc)]dx</strong></p>
<p>Solving this integral we then get y, but this is not an easy case and needs some time!</p>
<blockquote>I hope that you at least got an idea!</blockquote>
<p><br></p>
<h2>Constant coefficient cases [<em><strong>ay" + by' + cy = R(x)</strong></em>]</h2>
<p> There are many different cases that depend on the solutions p1, p2 of the characteristic equation and also the form that R(x) has!</p>
<p>Let's solve one of each! (I will leave out the complex R(x) case)</p>
<p><br></p>
<h3>1) p1, p2 will be real and R(x) exponential</h3>
<p><em>y" + 3y' + 2y = 2e^-x</em> [given ODE]</p>
<p>Let's write the homogeneous one:</p>
<p>y" + 3y' + 2y = 0</p>
<p>By substituting y = e^px we get the following:</p>
<p>p^2 + 3p + 2 = 0 [characteristic equation]</p>
<p>This one has the solutions:</p>
<p>p1, 2 = [-3 +- root(3^2 - 4*1*2)] / 2*1 =></p>
<p>p1, 2 = -3 +- 1 / 2 =></p>
<p>p1 = -1 and p2 = -2</p>
<p>That way y1 = e^(-x) and y2 = e^(-2x)</p>
<p>The general homogeneous solution (y0) is:</p>
<p>y0 = c1*e^(-x) + c2*e^(-2x), where c1, c2 reals</p>
<p><br></p>
<p>R(x) is exponential and k = -1</p>
<p>k = p1 = -1 and so we are in the 2nd case and yp is of the form:</p>
<p>yp = λ*x*e^(-x)</p>
<p>λ = ?</p>
<p>Let's first find the derivatives of yp and then put them in the given ODE.</p>
<p>y'p = [λ*x*e^(-x)]' = λ*[e^(-x) - x*e^(-x)] = λ*e^(-x)*(1-x)</p>
<p>y"p = { λ*e^(-x)*(1-x)}' = ... = λ*e^(-x) * (x-2)</p>
<p>By setting y, y' and y" to those in the given ODE we get:</p>
<p>λ*e^(-x) * (x-2) + 3*λ*e^(-x)*(1-x) + 2*λ*x*e^(-x) = 2e^(-x).</p>
<p>The e^(-x) parts are gone directly and so we get:</p>
<p>λ*(x-2) + 3*λ*(1-x) + 2*λ*x = 2 =></p>
<p>-2λ + 3λ = 2 => λ = 2</p>
<p>And that way yp = 2*x*e^(-x)</p>
<p>The general solution is:</p>
<p>y = y0 + yp =></p>
<p><strong>y = c1*e^(-x) + c2*e^(-2x) + 2*x*e^(-x)</strong></p>
<p><br></p>
<h3>2) p will be a double solution and R(x) polynomial</h3>
<p><em>y" - 2y' + y = 2x^2 - 3</em> [given ODE]</p>
<p>The corresponding homogeneous is:</p>
<p>y" - 2y' + y = 0</p>
<p>That way the characteristic equation is:</p>
<p>p^2 - 2p + 1 = 0 => (p-1)^2 = 0</p>
<p>And so we have one double solution p = 1.</p>
<p>The solutions are:</p>
<p>y1 = e^x and y2 = x*e^x</p>
<p>yo = c1*e^x + c2*xe^x, where c1, c2 reals</p>
<p><br></p>
<p>R(x) is of the polynomial and c!=0 and so we are in the first case and:</p>
<p>yp = bn*x^n + ... + b1*x + b0 =></p>
<p>yp = ax^2 + bx + c [2nd-order polynomial]</p>
<p>a, b, c = ?</p>
<p>Let's first find the derivatives:</p>
<p>yp' = 2ax + b</p>
<p>yp" = 2a</p>
<p>By substituting those in the given ODE we get:</p>
<p>(ax^2 + bx + c) -2*(2ax + b) + 2a = 2x^2 - 3.</p>
<p>Let's create a Ax^2 + Bx + C term on the left side:</p>
<p>ax^2 + (b - 4a)x + (c -2b + 2a) = 2x^2 -3</p>
<p>That way:</p>
<p>ax^2 = 2x^2 => a = 2</p>
<p>(b - 4a)x = 0x => b - 4a = 0 => b - 8 = 0 => b = 8</p>
<p>c - 2b + 2a = -3 => c -16 + 4 = -3 => c = 9</p>
<p>So, yp = 2x^2 + 8x - 9</p>
<p>The final solution is:</p>
<p>y = y0 + yp =></p>
<p><strong>y = c1*e^x + c2*xe^x + 2x^2 + 8x - 9</strong></p>
<p><br></p>
<h3>3) p1, p2 will be complex and R(x) trigonometric</h3>
<p><em>y" + y = 3sin(2x) </em> [given ODE]</p>
<p>The homogeneous is:</p>
<p>y" + y = 0</p>
<p>and characteristic equations is:</p>
<p>p^2 + 1 = 0 => p = root(-1) => p = +-i (complex number)</p>
<p>That way y1 = e^(ix) and y2 = e^(-ix)</p>
<p>Using Euler's equation [e^iφ = cosφ + i*sinφ] we end up with:</p>
<p>y1 = sinx and y2 = cosx</p>
<p>And so the general solution of the homogeneous is:</p>
<p>y0 = c1*sinx + c2*cosx, where c1, c2 are reals</p>
<p><br></p>
<p>R(x) is trigonometric and no solution is equal to it and so:</p>
<p>yp = s*cos(2x) + t*sin(2x)</p>
<p>yp' = -2s*sin(2x) + 2t*cos(2x)</p>
<p>yp" = -4s*cos(2x) - 4t*sin(2x)</p>
<p>(simple trigonometric loop derivation)</p>
<p>By substituting in the given ODE we get:</p>
<p>[-4s*cos(2x) - 4t*sin(2x)] + [s*cos(2x) + t*sin(2x)] = 3sin(2x) =></p>
<p>-3s*cos(2x) - 3t*sin(2x) = 3sin(2x) =></p>
<p>-3s = 0 => s = 0</p>
<p>and</p>
<p>-3t = 3 => t = -1</p>
<p>That way:</p>
<p>yp = -sin(2x)</p>
<p>And the general solution is:</p>
<p>y = yo + yp =></p>
<p><strong>y = c1*sinx + c2*cosx - sin(2x)</strong></p>
<p><br></p>
<h2>Euler case [ax^2y" + bxy' + cy = R(x)]</h2>
<p> A second-order ODE that has coefficients that look similar to a 2nd-order polynomial equation (ax^2 + bx + c) is called a Euler ODE.</p>
<p>To solve such a ODE, we substitute x= e^t and get a constant coefficient form.</p>
<p>Let's solve one!</p>
<p><br></p>
<p><em>x^2y" - 2xy' + 2y = x^3</em> [given Euler ODE]</p>
<p>We set x = e^t and get:</p>
<p> ayt" + (b-a)yt' + cyt = R1(t) =></p>
<p>y"(t) - 3y'(t) + 2y(t) =e^3t [Const coefficient ODE]</p>
<p>The homogeneous form is:</p>
<p>y"(t) - 3y'(t) + 2y(t) = 0</p>
<p>The characteristic equation is:</p>
<p>p^2 - 3p + 2 = 0</p>
<p>The solutions are: p1 = 1 and p2 = 2 and so:</p>
<p>y1 = e^t and y2 = e^2t</p>
<p>yo = c1*e^t + c2*e^2t, where c1, c2 are reals</p>
<p><br></p>
<p>For R(t) we have a exponential form, where p1, p2 != k and so:</p>
<p>yp = λ*e^3t </p>
<p>The derivatives are:</p>
<p>yp' = 3λ*e^3t</p>
<p>yp" = 9λ*e^3t</p>
<p>By substituting it in the const coefficient ODE we get:</p>
<p>9λ*e^3t - 3*3λ*e^3t + 2*λ*e^3t = e^3t =></p>
<p>9λ - 9λ + 2λ = 1 => λ = 1/2</p>
<p>That way:</p>
<p>yp = 1/2 * e^3t </p>
<p>And the general solution is:</p>
<p>y = y0 + yp =></p>
<p>y = c1*e^t + c2*e^2t + 1/2 * e^3t</p>
<p>By setting back x = e^t we get our final solution:</p>
<p><strong>y = c1*x + c2*x^2 + 1/2 * x^3</strong></p>
<p><br></p>
<h2>Wronsky case [unknown form, but one solution(p1) is known]</h2>
<p> Supposing one solution is given or can be found easily by testing some simple values we can find the second solution easily by using:</p>
<p> <em><strong>y1: known solution</strong></em> => <em><strong>y2 = y1*integral[W/y1^2]dx</strong></em> </p>
<p>For example suppose we have:</p>
<p>xy" - (x+2)y' + (1+2/x)y = 0 [given homogeneous ODE]</p>
<p>We know that x is a solution and we just have to find one more [y = y0].</p>
<p>So, we find W and then the solution y2.</p>
<p>W = e^integral(P(x)dx) => </p>
<p>W = e^integral(-(x+2)/x)dx => ... =></p>
<p>W = e^(-x - 2lnx) =></p>
<p>W = e^(-x) * e^(-2lnx) =></p>
<p>W = e^(-x) * e^[lnx^(-2)] =></p>
<p>W = e^(-x) / x^2</p>
<p><br></p>
<p>That way y2 = y1*integral[W/y1^2]dx =></p>
<p>y2 = x*integral[(e^(-x) / x^2)/x^2]dx =></p>
<p><strong>y2 = x*integral[e^(-x)/x^4]dx</strong></p>
<p>Time-taking integral that when solved gives us the 2nd solution and so:</p>
<p>y = y0 = c1y1 + c2y2</p>
<p><br></p>
<h2>Lagrange Method (canonical form) case</h2>
<p>There are two basic cases where we apply this method.</p>
<h3>1) Unknown or complicated ODE form</h3>
<p>Here we get the canonical form (Y" + AY = 0) and solve y = gY.</p>
<p>For example:</p>
<p><em>x^2y" + 4xy' + (2-x^2)y = 0 </em>[given ODE]</p>
<p>We set y = gY and get:</p>
<p>Y" + AY = 0.</p>
<p>A = -1/2*P' - 1/4*P^2 + Q =></p>
<p>A = -1/2*(4/x)' - 1/4*(4/x)^2 + (2/x^2 -1) => ... =></p>
<p>A = -1</p>
<p>And so we have:</p>
<p>Y" - Y = 0 [const coeffcient form]</p>
<p>p^2 - 1 = 0 => p1 = 1 and p2 = -1 and so:</p>
<p>Y1 = e^x and Y2 = e^(-x)</p>
<p>which means that Y = c1*e^x + c2*e^(-x), where c1, c2 are reals.</p>
<p><br></p>
<p>g(x) = e^[-1/2*integral(P(x)dx)] =></p>
<p>g(x) = e^[-1/2*integral(4/x)dx] =></p>
<p>g(x) = e^[-2*integral(1/x)dx] = e^[-2*lnx] = e^ln(-x^2) = 1/x^2</p>
<p><br></p>
<p>That way our final general solution is:</p>
<p>y = g*Y =></p>
<p><strong>y = c1*e^x / x^2 + c2*e^(-x) / x^2</strong></p>
<p><br></p>
<h3>2) R(x) of unknown form</h3>
<p>Here we find the solution yp using y1, y2 and W.</p>
<p>Suppose we have:</p>
<p><em>y" + 2y' + y = e^(-x) / x^2</em> [given const coeffcient ODE]</p>
<p>The homogeneous is:</p>
<p>y" + 2y' + y = 0</p>
<p>And so the characteristic equation is:</p>
<p>p^2 + 2p + 1 = 0</p>
<p>Which has one double solution p = -1</p>
<p>That way y1 = e^(-x) and y2 = x*e^(-x)</p>
<p>And so y0 = c1*e^(x) + c2*x*e^(-x), where c1, c2 are reals</p>
<p><br></p>
<p>The problem comes when we get into R(x) to find yp.</p>
<p>It's of an unknown form and so we have to use the equation:</p>
<p>yp = y2*integral[R(x)y1/W]dx - y1*integral[R(x)y2/W]dx </p>
<p><br></p>
<p>The Wronsky determinant will give us:</p>
<p>W = ... = e^(2-x) != 0 (will not do it, cause it's difficult to stylize)</p>
<p>and so we have linear independent solutions.</p>
<p>That way:</p>
<p>yp =</p>
<p>x*e^(-x) * integral[(e^(-x)/x^2)*e^(-x) / e^(-2x)] -</p>
<p>e^(-x) * integral[(e^(-x)/x^2)*x*e^(-x) / e^(-2x)] =></p>
<p>yp = x*e^(-x) * integral(1/x^2)dx - e^(-x) * integral(1/x)dx =></p>
<p>yp = x*e^(-x) * (-1/x) - e^(-x) * lnx =></p>
<p>yp = -e^(-x) * (1 + lnx)</p>
<p><br></p>
<p>That way our general solution is:</p>
<p>y = y0 + yp =></p>
<p><strong>y = c1*e^(x) + c2*x*e^(-x) -e^(-x) * (1 + lnx)</strong></p>
<p><br></p>
<h3>Previous posts of the series:</h3>
<p><a href="https://steemit.com/mathematics/@drifter1/mathematics-differential-equations-introduction">Introduction </a>-> Definition and Applications</p>
<p><a href="https://steemit.com/mathematics/@drifter1/mathematics-ordinary-first-order-differential-equations-part-1">First-order part(1) </a>-> Separable, homogeneous and exact 1st-order ODE's</p>
<p><a href="https://steemit.com/mathematics/@drifter1/mathematics-ordinary-first-order-differential-equations-part-2">First-order part(2)</a> -> Linear, Bernoulli and Riccati first-order ODE's</p>
<p><a href="https://steemit.com/mathematics/@drifter1/mathematics-first-order-differential-equation-exercises">First-order exercises</a> -> Exercises for all the 1st-order ODE types</p>
<p><a href="https://steemit.com/mathematics/@drifter1/mathematics-linear-second-order-differential-equations-with-constant-coefficients">Second-order linear with const coeffs</a> -> Constant coefficient linear 2nd-order ODE's </p>
<p><a href="https://steemit.com/mathematics/@drifter1/mathematics-euler-wronsky-and-canonical-linear-second-order-differential-equations">Special second-order forms</a> -> Linear Euler ODE, Wronsky and Lagrange (Canonical) methods</p>
<p><br></p>
<p>And this is it for today's post and I hope that you enjoyed it!</p>
<p>Next time we will get into how we solve any ODE using the Laplace method!</p>
<p>Bye!</p>
</html>