#set document(title: "2.5 Nonhomogeneous Equations", author: "Jiří Lebl") #set page(width: 8.5in, height: auto, margin: 1in) #import "@preview/cetz:0.5.2" #set text(font: ("STIX Two Text", "Libertinus Serif", "New Computer Modern"), size: 10.5pt, lang: "en") #show math.equation: set text(font: ("STIX Two Math", "New Computer Modern Math")) #set par(justify: true, leading: 0.62em, spacing: 0.9em) #set enum(spacing: 1.1em) // room between list items so tall inline fractions don't collide #set list(spacing: 1.1em) #set table(stroke: 0.5pt + rgb("#c7ccd3")) #let BLUE = rgb("#183B6F") // brand navy — section bars + example/solution labels (white on navy 11.09:1) #let ORANGE = rgb("#A94509") // brand primary-700 — AA-safe deep orange for TEXT (5.93:1 on white; raw brand #F37021 is 2.94:1 and must never carry text) #let RED = rgb("#DC2626") // brand error-600 #let GREEN = rgb("#059669") // brand success-600 (decoration only; small green text uses green-text #007942) #show heading.where(level: 1): it => block(width: 100%, above: 0pt, below: 16pt, fill: gradient.linear(BLUE, rgb("#2C5AA0")), inset: (x: 14pt, y: 12pt), radius: 3pt, text(fill: white, weight: "bold", size: 19pt, it.body)) #show heading.where(level: 2): it => block(width: 100%, above: 18pt, below: 10pt, fill: BLUE, inset: (x: 10pt, y: 6pt), radius: 2pt, text(fill: white, weight: "bold", size: 12pt, it.body)) #show heading.where(level: 3): it => text(fill: ORANGE, weight: "bold", size: 12.5pt, it.body) #show heading.where(level: 4): it => text(fill: BLUE, weight: "bold", size: 10.5pt, it.body) #let examplebox(label, title, body) = block(width: 100%, breakable: true, fill: rgb("#EFF1F5"), stroke: 0.5pt + rgb("#CFDDF0"), radius: 4pt, inset: 10pt, above: 12pt, below: 12pt)[ #block(below: 6pt)[#box(fill: BLUE, inset: (x: 6pt, y: 2pt), radius: 2pt, text(fill: white, weight: "bold", size: 8.5pt, label)) #h(0.4em) #strong[#title]] #body] // rail = decorative left rule (raw brand token); labelcolor = AA-safe label text shade #let notebox(label, rail, labelcolor, tint, body) = block(width: 100%, breakable: true, fill: tint, stroke: (left: 3pt + rail), inset: (left: 10pt, rest: 8pt), radius: (right: 4pt), above: 11pt, below: 11pt)[ #text(fill: labelcolor, weight: "bold", size: 7.5pt, tracking: 0.5pt)[#upper(label)] #linebreak() #body] #let solutionbox(body) = block(above: 4pt, below: 8pt)[ #text(fill: BLUE, weight: "bold", size: 8.5pt)[Solution] #linebreak() #body] #let figph(msg) = block(width: 100%, height: 60pt, fill: rgb("#f6f7f9"), stroke: (paint: rgb("#c7ccd3"), dash: "dashed"), radius: 4pt, inset: 10pt)[ #align(center + horizon, text(fill: rgb("#889"), style: "italic", size: 9pt, msg))] // Standardize inlined figure sizes: measure the natural CeTZ canvas, then scale to a // consistent envelope (aspect-aware; see build_typst.py FIG_* constants). Unlike the // print preamble, dimensions are FLOORED: in an editor a user can trim a figure to a // degenerate 1-D shape (a bare line), and w/h or tw/w would then divide by zero. #let _STD_W = 3.5 #let _WIDE_W = 5.6 #let _MAX_H = 3.4 #let _ASPECT_WIDE = 2.2 #let _UPSCALE_MAX = 1.15 #let stdfig(body) = context { let m = measure(body) let w = calc.max(m.width / 1in, 0.01) let h = calc.max(m.height / 1in, 0.01) let tw = if w / h > _ASPECT_WIDE { _WIDE_W } else { _STD_W } let s = calc.min(tw / w, _MAX_H / h, _UPSCALE_MAX) align(center, box(scale(x: s * 100%, y: s * 100%, reflow: true, body))) } #show figure: set block(breakable: false) #set figure(gap: 8pt) #show figure.caption: set text(size: 8.5pt, fill: rgb("#555")) == 2.5#h(0.6em)Nonhomogeneous Equations === Solving Nonhomogeneous Equations We have solved linear constant coefficient homogeneous equations. What about nonhomogeneous linear ODEs? For example, the equations for forced mechanical vibrations. That is, suppose we have an equation such as #math.equation(block: true, alt: "y double prime plus 5 y prime plus 6 y equals 2 x plus 1")[$y^(″) + 5 y^(′) + 6 y = 2 x + 1$] We will write #math.equation(block: false, alt: "L y equals 2 x plus 1")[$L y = 2 x + 1$] when the exact form of the operator is not important. We solve (Equation \\ref{2.5.1}) in the following manner. First, we find the general solution #math.equation(block: false, alt: "y sub c")[$y_(c)$] to the associated homogeneous equation #math.equation(block: true, alt: "y double prime plus 5 y prime plus 6 y equals 0")[$y^(″) + 5 y^(′) + 6 y = 0$] We call #math.equation(block: false, alt: "y sub c")[$y_(c)$] the#emph[complementary solution]. Next, we find a single particular solution #math.equation(block: false, alt: "y sub p")[$y_(p)$] to (2.5.1) in some way. Then #math.equation(block: true, alt: "y equals y sub c plus y sub p")[$y = y_(c) + y_(p)$] is the general solution to (2.5.1). We have #math.equation(block: false, alt: "L y sub c equals 0")[$L y_(c) = 0$] and #math.equation(block: false, alt: "L y sub p equals 2 x plus 1")[$L y_(p) = 2 x + 1$]. As #math.equation(block: false, alt: "L")[$L$] is a linear operator we verify that #math.equation(block: false, alt: "y")[$y$] is a solution, #math.equation(block: false, alt: "L y equals L open parenthesis y sub c plus y sub p close parenthesis equals L y sub c plus L y sub p equals 0 plus open parenthesis 2 x plus 1 close parenthesis")[$L y = L ( y_(c) + y_(p) ) = L y_(c) + L y_(p) = 0 + ( 2 x + 1 )$]. Let us see why we obtain the general solution. Let #math.equation(block: false, alt: "y sub p")[$y_(p)$] and #math.equation(block: false, alt: "y ~ sub p")[$tilde(y)_(p)$] be two different particular solutions to (2.5.1). Write the difference as #math.equation(block: false, alt: "w equals y sub p minus y ~ sub p")[$w = y_(p) − tilde(y)_(p)$]. Then plug #math.equation(block: false, alt: "w")[$w$] into the left hand side of the equation to get #math.equation(block: true, alt: "w double prime plus 5 w prime plus 6 w equals open parenthesis y p ″ plus 5 y p ′ plus 6 y sub p close parenthesis minus open parenthesis y ~ p ′ prime plus 5 y ~ p ′ plus 6 y ~ sub p close parenthesis equals open parenthesis 2 x plus 1 close parenthesis minus open parenthesis 2 x plus 1 close parenthesis equals 0")[$w^(″) + 5 w^(′) + 6 w = ( y_(p)^(″) + 5 y_(p)^(′) + 6 y_(p) ) − ( tilde(y)_(p)^(′)^(′) + 5 tilde(y)_(p)^(′) + 6 tilde(y)_(p) ) = ( 2 x + 1 ) − ( 2 x + 1 ) = 0$] Using the operator notation the calculation becomes simpler. As #math.equation(block: false, alt: "L")[$L$] is a linear operator we write #math.equation(block: true, alt: "L w equals L open parenthesis y sub p minus y ~ sub p close parenthesis equals L y sub p minus L y ~ sub p equals open parenthesis 2 x plus 1 close parenthesis minus open parenthesis 2 x plus 1 close parenthesis equals 0")[$L w = L ( y_(p) − tilde(y)_(p) ) = L y_(p) − L tilde(y)_(p) = ( 2 x + 1 ) − ( 2 x + 1 ) = 0$] So #math.equation(block: false, alt: "w equals y sub p minus y ~ sub p")[$w = y_(p) − tilde(y)_(p)$] is a solution to (2.5.2), that is #math.equation(block: false, alt: "L w equals 0")[$L w = 0$]. Any two solutions of (2.5.1) differ by a solution to the homogeneous equation (2.5.2). The solution #math.equation(block: false, alt: "y equals y sub c plus y sub p")[$y = y_(c) + y_(p)$] includes all solutions to (2.5.1), since #math.equation(block: false, alt: "y sub c")[$y_(c)$] is the general solution to the associated homogeneous equation. #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ Let #math.equation(block: false, alt: "L y equals f open parenthesis x close parenthesis")[$L y = f ( x )$] be a linear ODE (not necessarily constant coefficient). Let #math.equation(block: false, alt: "y sub c")[$y_(c)$] be the complementary solution (the general solution to the associated homogeneous equation #math.equation(block: false, alt: "L y equals 0")[$L y = 0$]) andlet #math.equation(block: false, alt: "y sub p")[$y_(p)$] be any particular solution to #math.equation(block: false, alt: "L y equals f open parenthesis x close parenthesis")[$L y = f ( x )$]. Then the general solution to #math.equation(block: false, alt: "L y equals f open parenthesis x close parenthesis")[$L y = f ( x )$] is #math.equation(block: true, alt: "y equals y sub c plus y sub p .")[$y = y_(c) + y_(p) .$] ] The moral of the story is that we can find the particular solution in any old way. If we find a different particular solution (by a different method, or simply by guessing), then we still get the same general solution. The formula may look different, and the constants we will have to choose to satisfy the initial conditions may be different, but it is the same solution. ==== Undetermined Coefficients The trick is to somehow, in a smart way, guess one particular solution to (2.5.1). Note that #math.equation(block: false, alt: "2 x plus 1")[$2 x + 1$] is a polynomial, and the left hand side of the equation will be a polynomial if we let #math.equation(block: false, alt: "y")[$y$] be a polynomial of the same degree. Let us try #math.equation(block: true, alt: "y sub p equals A x plus B")[$y_(p) = A x + B$] We plug in to obtain #math.equation(block: true, alt: "y p ′ prime plus 5 y p ′ plus 6 y sub p equals open parenthesis A x plus B close parenthesis double prime plus 5 open parenthesis A x plus B close parenthesis prime plus 6 open parenthesis A x plus B close parenthesis; equals 0 plus 5 A plus 6 A x plus 6 B equals 6 A x plus open parenthesis 5 A plus 6 B close parenthesis")[$y_(p)^(′)^(′) + 5 y_(p)^(′) + 6 y_(p) = ( A x + B )^(″) + 5 ( A x + B )^(′) + 6 ( A x + B ) \ = 0 + 5 A + 6 A x + 6 B = 6 A x + ( 5 A + 6 B )$] So #math.equation(block: false, alt: "6 A x plus open parenthesis 5 A plus 6 B close parenthesis equals 2 x plus 1")[$6 A x + ( 5 A + 6 B ) = 2 x + 1$]. Therefore, #math.equation(block: false, alt: "A equals the fraction 1 over 3")[$A = frac(1, 3)$] and #math.equation(block: false, alt: "B equals minus the fraction 1 over 9")[$B = − frac(1, 9)$]. That means #math.equation(block: false, alt: "y sub p equals the fraction 1 over 3 x minus the fraction 1 over 9 equals the fraction 3 x minus 1 over 9")[$y_(p) = frac(1, 3) x − frac(1, 9) = frac(3 x − 1, 9)$]. Solving the complementary problem (exercise!) we get #math.equation(block: true, alt: "y sub c equals C sub 1 e to the power minus 2 x plus C sub 2 e to the power minus 3 x")[$y_(c) = C_(1) e^(− 2 x) + C_(2) e^(− 3 x)$] Hence the general solution to (2.5.1) is #math.equation(block: true, alt: "y equals C sub 1 e to the power minus 2 x plus C sub 2 e to the power minus 3 x plus the fraction 3 x minus 1 over 9")[$y = C_(1) e^(− 2 x) + C_(2) e^(− 3 x) + frac(3 x − 1, 9)$] Now suppose we are further given some initial conditions. For example, #math.equation(block: false, alt: "y open parenthesis 0 close parenthesis equals 0")[$y ( 0 ) = 0$] and #math.equation(block: false, alt: "y prime open parenthesis 0 close parenthesis equals the fraction 1 over 3")[$y^(′) ( 0 ) = frac(1, 3)$]. First find #math.equation(block: false, alt: "y prime equals minus 2 C sub 1 e to the power minus 2 x minus 3 C sub 2 e to the power minus 3 x plus the fraction 1 over 3")[$y^(′) = − 2 C_(1) e^(− 2 x) − 3 C_(2) e^(− 3 x) + frac(1, 3)$]. Then #math.equation(block: true, alt: "0 equals y open parenthesis 0 close parenthesis equals C sub 1 plus C sub 2 minus the fraction 1 over 9 , the fraction 1 over 3 equals y prime open parenthesis 0 close parenthesis equals minus 2 C sub 1 minus 3 C sub 2 plus the fraction 1 over 3")[$0 = y ( 0 ) = C_(1) + C_(2) − frac(1, 9) , frac(1, 3) = y^(′) ( 0 ) = − 2 C_(1) − 3 C_(2) + frac(1, 3)$] We solve to get #math.equation(block: false, alt: "C sub 1 equals the fraction 1 over 3")[$C_(1) = frac(1, 3)$] and #math.equation(block: false, alt: "C sub 2 equals minus the fraction 2 over 9")[$C_(2) = − frac(2, 9)$]. The particular solution we want is #math.equation(block: true, alt: "y open parenthesis x close parenthesis equals the fraction 1 over 3 e to the power minus 2 x minus the fraction 2 over 9 e to the power minus 3 x plus the fraction 3 x minus 1 over 9 equals the fraction 3 e to the power minus 2 x minus 2 e to the power minus 3 x plus 3 x minus 1 over 9")[$y ( x ) = frac(1, 3) e^(− 2 x) − frac(2, 9) e^(− 3 x) + frac(3 x − 1, 9) = frac(3 e^(− 2 x) − 2 e^(− 3 x) + 3 x − 1, 9)$] #notebox("Your Turn", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ Check that #math.equation(block: false, alt: "y")[$y$] really solves the equation (2.5.1)and the given initial conditions. #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ #emph[Note] A common mistake is to solve for constants using the initial conditions with #math.equation(block: false, alt: "y sub c")[$y_(c)$] and only add the particular solution #math.equation(block: false, alt: "y sub p")[$y_(p)$] after that. That will not work. You need to first compute #math.equation(block: false, alt: "y equals y sub c plus y sub p")[$y = y_(c) + y_(p)$] and only then solve for the constants using the initial conditions. ] ] A right hand side consisting of exponentials, sines, and cosines can be handled similarly. For example, #math.equation(block: true, alt: "y double prime plus 2 y prime plus 2 y equals cos open parenthesis 2 x close parenthesis")[$y^(″) + 2 y^(′) + 2 y = cos ( 2 x )$] Let us find some #math.equation(block: false, alt: "y sub p")[$y_(p)$]. We start by guessing the solution includes some multiple of #math.equation(block: false, alt: "cos open parenthesis 2 x close parenthesis")[$cos ( 2 x )$]. We may have to also add a multiple of #math.equation(block: false, alt: "sin open parenthesis 2 x close parenthesis")[$sin ( 2 x )$] to our guess since derivatives of cosine are sines. We try #math.equation(block: true, alt: "y sub p equals A cos open parenthesis 2 x close parenthesis plus B sin open parenthesis 2 x close parenthesis")[$y_(p) = A cos ( 2 x ) + B sin ( 2 x )$] We plug #math.equation(block: false, alt: "y sub p")[$y_(p)$] into the equation and we get #math.equation(block: true, alt: "minus 4 A cos open parenthesis 2 x close parenthesis minus 4 B sin open parenthesis 2 x close parenthesis ⏟ y p ′ prime plus 2 open parenthesis minus 2 A sin open parenthesis 2 x close parenthesis plus 2 B cos open parenthesis 2 x close parenthesis close parenthesis ⏟ y p ′; plus 2 open parenthesis A cos open parenthesis 2 x close parenthesis plus 2 B sin open parenthesis 2 x close parenthesis close parenthesis ⏟ y sub p equals cos open parenthesis 2 x close parenthesis ,")[$limits(underbrace(− 4 A cos ( 2 x ) − 4 B sin ( 2 x )))_(y_(p)^(′)^(′)) + 2 limits(underbrace(( − 2 A sin ( 2 x ) + 2 B cos ( 2 x ) )))_(y_(p)^(′)) \ + 2 limits(underbrace(( A cos ( 2 x ) + 2 B sin ( 2 x ) )))_(y_(p)) = cos ( 2 x ) ,$] The left hand side must equal to right hand side. We group terms and we get that #math.equation(block: false, alt: "minus 4 A plus 4 B plus 2 A equals 1")[$− 4 A + 4 B + 2 A = 1$] and #math.equation(block: false, alt: "minus 4 B minus 4 A plus 2 B equals 0")[$− 4 B − 4 A + 2 B = 0$]. So #math.equation(block: false, alt: "minus 2 A plus 4 B equals 1")[$− 2 A + 4 B = 1$] and #math.equation(block: false, alt: "2 A plus B equals 0")[$2 A + B = 0$] and hence #math.equation(block: false, alt: "A equals the fraction minus 1 over 10")[$A = frac(− 1, 10)$] and #math.equation(block: false, alt: "B equals the fraction 1 over 5")[$B = frac(1, 5)$]. So #math.equation(block: true, alt: "y sub p equals A cos open parenthesis 2 x close parenthesis plus B sin open parenthesis 2 x close parenthesis equals the fraction minus cos open parenthesis 2 x close parenthesis plus 2 sin open parenthesis 2 x close parenthesis over 10")[$y_(p) = A cos ( 2 x ) + B sin ( 2 x ) = frac(− cos ( 2 x ) + 2 sin ( 2 x ), 10)$] Similarly, if the right hand side contains exponentials we try exponentials. For example, for #math.equation(block: true, alt: "L y equals e to the power 3 x")[$L y = e^(3 x)$] we will try #math.equation(block: false, alt: "y equals A e to the power 3 x")[$y = A e^(3 x)$] as our guess and try to solve for #math.equation(block: false, alt: "A")[$A$]. When the right hand side is a multiple of sines, cosines, exponentials, and polynomials, we can use the product rule for differentiation to come up with a guess. We need to guess a form for #math.equation(block: false, alt: "y sub p")[$y_(p)$] such that #math.equation(block: false, alt: "L y sub p")[$L y_(p)$] is of the same form, and has all the terms needed to for the right hand side. For example, #math.equation(block: true, alt: "L y equals open parenthesis 1 plus 3 x squared close parenthesis e to the power minus x cos open parenthesis π x close parenthesis")[$L y = ( 1 + 3 x^(2) ) e^(− x) cos ( π x )$] For this equation, we will guess #math.equation(block: true, alt: "y sub p equals open parenthesis A plus B x plus C x squared close parenthesis e to the power minus x cos open parenthesis π x close parenthesis plus open parenthesis D plus E x plus F x squared close parenthesis e to the power minus x sin open parenthesis π x close parenthesis")[$y_(p) = ( A + B x + C x^(2) ) e^(− x) cos ( π x ) + ( D + E x + F x^(2) ) e^(− x) sin ( π x )$] We will plug in and then hopefully get equations that we can solve for #math.equation(block: false, alt: "A , B , C , D , E")[$A , B , C , D , E$]and #math.equation(block: false, alt: "F")[$F$]. As you can see this can make for a very long and tedious calculation very quickly. There is one hiccup in all this. It could be that our guess actually solves the associated homogeneous equation. That is, suppose we have #math.equation(block: true, alt: "y double prime minus 9 y equals e to the power 3 x")[$y^(″) − 9 y = e^(3 x)$] We would love to guess #math.equation(block: false, alt: "y equals A e to the power 3 x")[$y = A e^(3 x)$], but if we plug this into the left hand side of the equation we get #math.equation(block: true, alt: "y double prime minus 9 y equals 9 A e to the power 3 x minus 9 A e to the power 3 x equals 0 not equal to e to the power 3 x")[$y^(″) − 9 y = 9 A e^(3 x) − 9 A e^(3 x) = 0 ≠ e^(3 x)$] There is no way we can choose #math.equation(block: false, alt: "A")[$A$] to make the left hand side be #math.equation(block: false, alt: "e to the power 3 x")[$e^(3 x)$]. The trick in this case is to multiply our guess by #math.equation(block: false, alt: "x")[$x$] to get rid of duplication with the complementary solution. That is first we compute #math.equation(block: false, alt: "y sub c")[$y_(c)$] (solution to #math.equation(block: false, alt: "L y equals 0")[$L y = 0$]) #math.equation(block: true, alt: "y sub c equals C sub 1 e to the power minus 3 x plus C sub 2 e to the power 3 x")[$y_(c) = C_(1) e^(− 3 x) + C_(2) e^(3 x)$] and we note that the #math.equation(block: false, alt: "e to the power 3 x")[$e^(3 x)$] term is a duplicate with our desired guess. We modify our guess to #math.equation(block: false, alt: "y equals A x e to the power 3 x")[$y = A x e^(3 x)$] and notice there is no duplication anymore. Let us try. Note that #math.equation(block: false, alt: "y prime equals A e to the power 3 x plus 3 A x e to the power 3 x")[$y^(′) = A e^(3 x) + 3 A x e^(3 x)$] and #math.equation(block: false, alt: "y double prime equals 6 A e to the power 3 x plus 9 A x e to the power 3 x")[$y^(″) = 6 A e^(3 x) + 9 A x e^(3 x)$]. So #math.equation(block: true, alt: "y double prime minus 9 y equals 6 A e to the power 3 x plus 9 A x e to the power 3 x minus 9 A x e to the power 3 x equals 6 A e to the power 3 x")[$y^(″) − 9 y = 6 A e^(3 x) + 9 A x e^(3 x) − 9 A x e^(3 x) = 6 A e^(3 x)$] Thus #math.equation(block: false, alt: "6 A e to the power 3 x")[$6 A e^(3 x)$] is supposed to equal #math.equation(block: false, alt: "e to the power 3 x")[$e^(3 x)$]. Hence, #math.equation(block: false, alt: "6 A equals 1")[$6 A = 1$] and so #math.equation(block: false, alt: "A equals the fraction 1 over 6")[$A = frac(1, 6)$]. We can now write the general solution as #math.equation(block: true, alt: "y equals y sub c plus y sub p equals C sub 1 e to the power minus 3 x plus C sub 2 e to the power 3 x plus the fraction 1 over 6 x e to the power 3 x")[$y = y_(c) + y_(p) = C_(1) e^(− 3 x) + C_(2) e^(3 x) + frac(1, 6) x e^(3 x)$] It is possible that multiplying by #math.equation(block: false, alt: "x")[$x$] does not get rid of all duplication. For example, #math.equation(block: true, alt: "y double prime minus 6 y prime plus 9 y equals e to the power 3 x")[$y^(″) − 6 y^(′) + 9 y = e^(3 x)$] The complementary solution is #math.equation(block: false, alt: "y sub c equals C sub 1 e to the power 3 x plus C sub 2 x e to the power 3 x")[$y_(c) = C_(1) e^(3 x) + C_(2) x e^(3 x)$]. Guessing #math.equation(block: false, alt: "y equals A x e to the power 3 x")[$y = A x e^(3 x)$] would not get us anywhere. In this case we want to guess #math.equation(block: false, alt: "y sub p equals A x squared e to the power 3 x")[$y_(p) = A x^(2) e^(3 x)$]. Basically, we want to multiply our guess by #math.equation(block: false, alt: "x")[$x$] until all duplication is gone. But no more! Multiplying too many times will not work. Finally, what if the right hand side has several terms, such as #math.equation(block: true, alt: "L y equals e to the power 2 x plus cos x")[$L y = e^(2 x) + cos x$] In this case we find #math.equation(block: false, alt: "u")[$u$] that solves #math.equation(block: false, alt: "L u equals e to the power 2 x")[$L u = e^(2 x)$] and #math.equation(block: false, alt: "v")[$v$] that solves #math.equation(block: false, alt: "L v equals cos x")[$L v = cos x$] (that is, do each term separately). Then note that if #math.equation(block: false, alt: "y equals u plus v")[$y = u + v$], then #math.equation(block: false, alt: "L y equals e to the power 2 x plus cos x")[$L y = e^(2 x) + cos x$]. This is because #math.equation(block: false, alt: "L")[$L$] is linear; we have #math.equation(block: false, alt: "L y equals L open parenthesis u plus v close parenthesis equals L u plus L v equals e to the power 2 x plus cos x")[$L y = L ( u + v ) = L u + L v = e^(2 x) + cos x$]. ==== Variation of Parameters The method of undetermined coefficients will work for many basic problems that crop up. But it does not work all the time. It only works when the right hand side of the equation #math.equation(block: false, alt: "L y equals f open parenthesis x close parenthesis")[$L y = f ( x )$] has only finitely many linearly independent derivatives, so that we can write a guess that consists of them all. Some equations are a bit tougher. Consider #math.equation(block: true, alt: "y double prime plus y equals tan x")[$y^(″) + y = tan x$] Note that each new derivative of #math.equation(block: false, alt: "tan x")[$tan x$] looks completely different and cannot be written as a linear combination of the previous derivatives. If we start differentiating #math.equation(block: false, alt: "tan x")[$tan x$], we get #math.equation(block: true, alt: "sec squared x , 2 sec squared x tan x , 4 sec squared x tan squared x plus 2 sec to the power 4 x ,; 8 sec squared x tan cubed x plus 16 sec to the power 4 x tan x , 16 sec squared x tan to the power 4 x plus 88 sec to the power 4 x tan squared x plus 16 sec to the power 6 x , …")[$sec^(2) x , #h(1em) 2 sec^(2) x tan x , #h(1em) 4 sec^(2) x tan^(2) x + 2 sec^(4) x , \ 8 sec^(2) x tan^(3) x + 16 sec^(4) x tan x , #h(1em) 16 sec^(2) x tan^(4) x + 88 sec^(4) x tan^(2) x + 16 sec^(6) x , #h(1em) …$] This equation calls for a different method. We present the method of variation of parameters, which will handle any equation of the form #math.equation(block: false, alt: "L y equals f open parenthesis x close parenthesis")[$L y = f ( x )$], provided we can solve certain integrals. For simplicity, we restrict ourselves to second order constant coefficient equations, but the method works for higher order equations just as well (the computations become more tedious). The method also works for equations with nonconstant coefficients, provided we can solve the associated homogeneous equation. Perhaps it is best to explain this method by example. Let us try to solve the equation #math.equation(block: true, alt: "L y equals y double prime plus y equals tan x")[$L y = y^(″) + y = tan x$] First we find the complementary solution (solution to #math.equation(block: false, alt: "L y sub c equals 0")[$L y_(c) = 0$]). We get #math.equation(block: false, alt: "y sub c equals C sub 1 y sub 1 plus C sub 2 y sub 2")[$y_(c) = C_(1) y_(1) + C_(2) y_(2)$], where #math.equation(block: false, alt: "y sub 1 equals cos x")[$y_(1) = cos x$] and #math.equation(block: false, alt: "y sub 2 equals sin x")[$y_(2) = sin x$]. To find a particular solution to the nonhomogeneous equation we try #math.equation(block: true, alt: "y sub p equals y equals u sub 1 y sub 1 plus u sub 2 y sub 2")[$y_(p) = y = u_(1) y_(1) + u_(2) y_(2)$] where #math.equation(block: false, alt: "u sub 1")[$u_(1)$] and #math.equation(block: false, alt: "u sub 2")[$u_(2)$] are functions and not constants. We are trying to satisfy #math.equation(block: false, alt: "L y equals tan x")[$L y = tan x$]. That gives us one condition on the functions #math.equation(block: false, alt: "u sub 1")[$u_(1)$] and #math.equation(block: false, alt: "u sub 2")[$u_(2)$]. Compute (note the product rule!) #math.equation(block: true, alt: "y prime equals open parenthesis u 1 ′ y sub 1 plus u 2 ′ y sub 2 close parenthesis plus open parenthesis u sub 1 y 1 ′ plus u sub 2 y 2 ′ close parenthesis")[$y^(′) = ( u_(1)^(′) y_(1) + u_(2)^(′) y_(2) ) + ( u_(1) y_(1)^(′) + u_(2) y_(2)^(′) )$] We can still impose one more condition at our discretion to simplify computations (we have two unknown functions, so we should be allowed two conditions). We require that #math.equation(block: false, alt: "open parenthesis u 1 ′ y sub 1 plus u 2 ′ y sub 2 close parenthesis equals 0")[$( u_(1)^(′) y_(1) + u_(2)^(′) y_(2) ) = 0$]. This makes computing the second derivative easier. #math.equation(block: true, alt: "y prime equals u sub 1 y 1 ′ plus u sub 2 y 2 ′; y double prime equals open parenthesis u 1 ′ y 1 ′ plus u 2 ′ y 2 ′ close parenthesis plus open parenthesis u sub 1 y 1 ″ plus u sub 2 y 2 ″ close parenthesis")[$y^(′) = u_(1) y_(1)^(′) + u_(2) y_(2)^(′) \ y^(″) = ( u_(1)^(′) y_(1)^(′) + u_(2)^(′) y_(2)^(′) ) + ( u_(1) y_(1)^(″) + u_(2) y_(2)^(″) )$] Since #math.equation(block: false, alt: "y sub 1")[$y_(1)$] and #math.equation(block: false, alt: "y sub 2")[$y_(2)$] are solutions to #math.equation(block: false, alt: "y double prime plus y equals 0")[$y^(″) + y = 0$], we know that #math.equation(block: false, alt: "y 1 ″ equals minus y sub 1")[$y_(1)^(″) = − y_(1)$] and #math.equation(block: false, alt: "y 2 ″ equals minus y sub 2")[$y_(2)^(″) = − y_(2)$]. (Note: If the equation was instead #math.equation(block: false, alt: "y double prime plus p open parenthesis x close parenthesis y prime plus q open parenthesis x close parenthesis y equals 0")[$y^(″) + p ( x ) y^(′) + q ( x ) y = 0$] we would have #math.equation(block: false, alt: "y i ″ equals minus p open parenthesis x close parenthesis y i ′ minus q open parenthesis x close parenthesis y sub i")[$y_(i)^(″) = − p ( x ) y_(i)^(′) − q ( x ) y_(i)$].) So #math.equation(block: true, alt: "y double prime equals open parenthesis u 1 ′ y 1 ′ plus u 2 ′ y 2 ′ close parenthesis minus open parenthesis u sub 1 y sub 1 plus u sub 2 y sub 2 close parenthesis")[$y^(″) = ( u_(1)^(′) y_(1)^(′) + u_(2)^(′) y_(2)^(′) ) − ( u_(1) y_(1) + u_(2) y_(2) )$] We have #math.equation(block: false, alt: "open parenthesis u sub 1 y sub 1 plus u sub 2 y sub 2 close parenthesis equals y")[$( u_(1) y_(1) + u_(2) y_(2) ) = y$] and so #math.equation(block: true, alt: "y double prime equals open parenthesis u 1 ′ y 1 ′ plus u 2 ′ y 2 ′ close parenthesis minus y")[$y^(″) = ( u_(1)^(′) y_(1)^(′) + u_(2)^(′) y_(2)^(′) ) − y$] and hence #math.equation(block: true, alt: "y double prime plus y equals L y equals u 1 ′ y 1 ′ plus u 2 ′ y 2 ′")[$y^(″) + y = L y = u_(1)^(′) y_(1)^(′) + u_(2)^(′) y_(2)^(′)$] For #math.equation(block: false, alt: "y")[$y$] to satisfy #math.equation(block: false, alt: "L y equals f open parenthesis x close parenthesis")[$L y = f ( x )$] we must have #math.equation(block: false, alt: "f open parenthesis x close parenthesis equals u 1 ′ y 1 ′ plus u 2 ′ y 2 ′")[$f ( x ) = u_(1)^(′) y_(1)^(′) + u_(2)^(′) y_(2)^(′)$]. So what we need to solve are the two equations (conditions) we imposed on #math.equation(block: false, alt: "u sub 1")[$u_(1)$] and #math.equation(block: false, alt: "u sub 2")[$u_(2)$] #math.equation(block: true, alt: "u 1 ′ y sub 1 plus u 2 ′ y sub 2 equals 0; u 1 ′ y 1 ′ plus u 2 ′ y 2 ′ equals f open parenthesis x close parenthesis")[$u_(1)^(′) y_(1) + u_(2)^(′) y_(2) = 0 \ u_(1)^(′) y_(1)^(′) + u_(2)^(′) y_(2)^(′) = f ( x )$] We can now solve for #math.equation(block: false, alt: "u 1 ′")[$u_(1)^(′)$] and #math.equation(block: false, alt: "u 2 ′")[$u_(2)^(′)$] in terms of #math.equation(block: false, alt: "f open parenthesis x close parenthesis , y sub 1")[$f ( x ) , y_(1)$] and #math.equation(block: false, alt: "y sub 2")[$y_(2)$]. We will always get these formulas for any #math.equation(block: false, alt: "L y equals f open parenthesis x close parenthesis")[$L y = f ( x )$], where #math.equation(block: false, alt: "L y equals y double prime plus p open parenthesis x close parenthesis y prime plus q open parenthesis x close parenthesis y")[$L y = y^(″) + p ( x ) y^(′) + q ( x ) y$]. There is a general formula for the solution we can just plug into, but it is better to just repeat what we do below. In our case the two equations become #math.equation(block: true, alt: "u 1 ′ cos open parenthesis x close parenthesis plus u 2 ′ sin open parenthesis x close parenthesis equals 0; minus u 1 ′ sin open parenthesis x close parenthesis plus u 2 ′ cos open parenthesis x close parenthesis equals tan open parenthesis x close parenthesis")[$u_(1)^(′) cos ( x ) + u_(2)^(′) sin ( x ) = 0 \ − u_(1)^(′) sin ( x ) + u_(2)^(′) cos ( x ) = tan ( x )$] Hence #math.equation(block: true, alt: "u 1 ′ cos open parenthesis x close parenthesis sin open parenthesis x close parenthesis plus u 2 ′ sin squared open parenthesis x close parenthesis equals 0; minus u 1 ′ sin open parenthesis x close parenthesis cos open parenthesis x close parenthesis plus u 2 ′ cos squared open parenthesis x close parenthesis equals tan open parenthesis x close parenthesis cos open parenthesis x close parenthesis equals sin open parenthesis x close parenthesis")[$u_(1)^(′) cos ( x ) sin ( x ) + u_(2)^(′) sin^(2) ( x ) = 0 \ − u_(1)^(′) sin ( x ) cos ( x ) + u_(2)^(′) cos^(2) ( x ) = tan ( x ) cos ( x ) = sin ( x )$] And thus #math.equation(block: true, alt: "u 2 ′ open parenthesis sin squared open parenthesis x close parenthesis plus cos squared open parenthesis x close parenthesis close parenthesis equals sin open parenthesis x close parenthesis; u 2 ′ equals sin open parenthesis x close parenthesis; u 1 ′ equals the fraction minus sin squared open parenthesis x close parenthesis over cos open parenthesis x close parenthesis equals minus tan open parenthesis x close parenthesis sin open parenthesis x close parenthesis")[$u_(2)^(′) ( sin^(2) ( x ) + cos^(2) ( x ) ) = sin ( x ) \ u_(2)^(′) = sin ( x ) \ u_(1)^(′) = frac(− sin^(2) ( x ), cos ( x )) = − tan ( x ) sin ( x )$] Now we need to integrate #math.equation(block: false, alt: "u 1 ′")[$u_(1)^(′)$] and #math.equation(block: false, alt: "u 2 ′")[$u_(2)^(′)$] to get #math.equation(block: false, alt: "u sub 1")[$u_(1)$] and #math.equation(block: false, alt: "u sub 2")[$u_(2)$]. #math.equation(block: true, alt: "u sub 1 equals ∫ u 1 ′ d x equals ∫ minus tan open parenthesis x close parenthesis sin open parenthesis x close parenthesis d x equals the fraction 1 over 2 ln ∣ the fraction sin open parenthesis x close parenthesis minus 1 over sin open parenthesis x close parenthesis plus 1 ∣ plus sin open parenthesis x close parenthesis; u sub 2 equals ∫ u 2 ′ d x equals ∫ sin open parenthesis x close parenthesis d x equals minus cos open parenthesis x close parenthesis")[$u_(1) = ∫ u_(1)^(′) d x = ∫ − tan ( x ) sin ( x ) d x = frac(1, 2) ln ∣ frac(sin ( x ) − 1, sin ( x ) + 1) ∣ + sin ( x ) \ u_(2) = ∫ u_(2)^(′) d x = ∫ sin ( x ) d x = − cos ( x )$] So our particular solution is #math.equation(block: true, alt: "y sub p equals u sub 1 y sub 1 plus u sub 2 y sub 2 equals the fraction 1 over 2 cos open parenthesis x close parenthesis ln ∣ the fraction sin open parenthesis x close parenthesis minus 1 over sin open parenthesis x close parenthesis plus 1 ∣ plus cos open parenthesis x close parenthesis sin open parenthesis x close parenthesis minus cos open parenthesis x close parenthesis sin open parenthesis x close parenthesis; equals the fraction 1 over 2 cos open parenthesis x close parenthesis ln ∣ the fraction sin open parenthesis x close parenthesis minus 1 over sin open parenthesis x close parenthesis plus 1 ∣")[$y_(p) = u_(1) y_(1) + u_(2) y_(2) = frac(1, 2) cos ( x ) ln ∣ frac(sin ( x ) − 1, sin ( x ) + 1) ∣ + cos ( x ) sin ( x ) − cos ( x ) sin ( x ) \ = frac(1, 2) cos ( x ) ln ∣ frac(sin ( x ) − 1, sin ( x ) + 1) ∣$] The general solution to #math.equation(block: false, alt: "y double prime plus y equals tan x")[$y^(″) + y = tan x$] is, therefore, #math.equation(block: true, alt: "y equals C sub 1 cos open parenthesis x close parenthesis plus C sub 2 sin open parenthesis x close parenthesis plus the fraction 1 over 2 cos open parenthesis x close parenthesis ln ∣ the fraction sin open parenthesis x close parenthesis minus 1 over sin open parenthesis x close parenthesis plus 1 ∣")[$y = C_(1) cos ( x ) + C_(2) sin ( x ) + frac(1, 2) cos ( x ) ln ∣ frac(sin ( x ) − 1, sin ( x ) + 1) ∣$] - - #link("http://www.jirka.org/diffyqs/")[Jiří Lebl] (#link("http://www.math.okstate.edu/")[Oklahoma State University]).These pages were supported by NSF grants DMS-0900885 and DMS-1362337.