Difference between revisions of "Differential Equations"
Line 1: | Line 1: | ||
− | + | '''Ordinary differential equations''' involve equations containing: | |
+ | * variables | ||
+ | * functions | ||
+ | * their derivatives | ||
+ | and their solutions. | ||
− | In | + | In studying integration, you ''already'' have considered solutions to very simple differential equations. For example, when you look to solving |
+ | : <math>\int f(x) \,dx=g(x)</math> | ||
+ | for g(x), you are really solving the differential equation | ||
+ | : <math> g'(x) = f(x) \,</math> | ||
− | + | == Notations and terminology == | |
+ | The notations we use for solving differential equations will be crucial in the ease of solubility for these equations. | ||
− | + | This document will be using '''three''' notations primarily: | |
+ | * f' to denote the derivative of f | ||
+ | * D ''f'' to denote the derivative of ''f'' | ||
+ | * <math>{df \over dx}</math> to denote the derivative of ''f'' (for separable equations). | ||
− | == | + | === Terminology === |
+ | Consider the differential equation | ||
+ | : <math>3 f^{\prime \prime}(x)+5xf(x)=11</math> | ||
− | + | Since the equation's highest derivative is 2, we say that the differential equation is of ''order'' 2. | |
− | :<math> | + | == Some simple differential equations == |
− | \ | + | A key idea in solving differential equations will be that of [[Calculus/Definite integral|integration]]. |
− | + | ||
− | + | Let us consider the second order differential equation (remember that a function acts on a value). | |
− | + | :<math>f''(x)=2 \,</math> | |
− | \ | + | |
+ | How would we go about solving this? It tells us that on differentiating twice, we obtain the constant 2 so, if we integrate twice, we should obtain our result. | ||
+ | |||
+ | Integrating once first of all: | ||
+ | |||
+ | :<math>\int f''(x) \,dx = \int 2 \,dx</math> | ||
+ | :<math>f'(x)=2x+C_1 \,</math> | ||
+ | |||
+ | We have transformed the apparently difficult second order differential equation into a rather simpler one, viz. | ||
+ | |||
+ | :<math>f'(x)=2x+C_1 \,</math> | ||
+ | |||
+ | This equation tells us that if we differentiate a function once, we get <math>2x+C_1</math>. If we integrate once more, we should find the solution. | ||
+ | |||
+ | :<math>\int f'(x) \,dx = \int 2x+C_1 \,dx</math> | ||
+ | :<math>f(x)=x^2+C_1x+C_2 \,</math> | ||
+ | |||
+ | This is the ''solution'' to the differential equation. We will get <math>f''=2 \,</math> for ''all'' values of <math>C_1</math> and <math>C_2</math>. | ||
+ | |||
+ | The values <math>C_1</math> and <math>C_2</math> are related to quantities known as ''initial conditions''. | ||
+ | |||
+ | Why are initial conditions useful? ODEs (ordinary differential equations) are useful in modeling physical conditions. We may wish to model a certain physical system which is initially at rest (so one initial condition may be zero), or wound up to some point (so an initial condition may be nonzero, say 5 for instance) and we may wish to see how the system reacts under such an initial condition. | ||
+ | |||
+ | When we solve a system with given initial conditions, we substitute them after our process of integration. | ||
+ | ===Example=== | ||
+ | When we solved <math>f''(x)=2 \,</math> say we had the initial conditions <math>f'(0)=3 \,</math> and <math>f(0)=2 \,</math>. (Note, initial conditions need not occur at f(0)). | ||
+ | |||
+ | After we integrate we make substitutions: | ||
+ | :<math>f'(0)=2(0)+C_1 \,</math> | ||
+ | :<math>3=C_1 \,</math> | ||
+ | :<math>\int f'(x) \,dx = \int 2x+3 \,dx</math> | ||
+ | :<math>f(x)=x^2+3x+C_2 \,</math> | ||
+ | :<math>f(0)=0^2+3(0)+C_2 \,</math> | ||
+ | :<math>2=C_2 \,</math> | ||
+ | :<math>f(x)=x^2+3x+2 \,</math> | ||
+ | |||
+ | Without initial conditions, the answer we obtain is known as the ''general solution'' or the solution to the ''family of equations''. With them, our solution is known as a ''specific solution''. | ||
+ | |||
+ | == Basic first order DEs == | ||
+ | In this section we will consider ''four'' main types of differential equations: | ||
+ | * separable | ||
+ | * homogeneous | ||
+ | * linear | ||
+ | * exact | ||
+ | |||
+ | There are many other forms of differential equation, however, and these will be dealt with in the next section | ||
+ | |||
+ | === Separable equations === | ||
+ | A ''separable'' equation is in the form (using dy/dx notation which will serve us greatly here) | ||
+ | :<math>{dy \over dx} = f(x)/g(y)</math> | ||
+ | |||
+ | Previously we have only dealt with simple differential equations with g(''y'')=1. How do we solve such a separable equation as above? | ||
+ | |||
+ | We group ''x'' and ''dx'' terms together, and ''y'' and ''dy'' terms together as well. | ||
+ | :<math>g(y)\ dy = f(x)\ dx</math> | ||
+ | Integrating both sides with respect to y on the left hand side and x on the right hand side: | ||
+ | :<math>\int g(y)\,dy=\int f(x)\,dx+C</math> | ||
+ | |||
+ | we will obtain the solution. | ||
+ | |||
+ | ==== Worked example ==== | ||
+ | Here is a worked example illustrating the process. | ||
+ | |||
+ | We are asked to solve | ||
+ | :<math>{dy \over dx} = 3x^2y</math> | ||
+ | |||
+ | Separating | ||
+ | :<math>{dy \over y} = (3x^2)\,dx</math> | ||
+ | Integrating | ||
+ | :<math>\int {dy \over y} = \int 3x^2\,dx</math> | ||
+ | :<math>\ln{y}=x^3+C \,\!</math> | ||
+ | :<math>y=e^{x^3+C}</math> | ||
+ | Letting <math>k = e^C</math> where k is a constant we obtain | ||
+ | :<math>y=ke^{x^3}</math> | ||
+ | which is the general solution. | ||
+ | |||
+ | ==== Verification ==== | ||
+ | This step does not need to be part of your work, but if you want to check your solution, you can verify your answer by differentiation. | ||
+ | |||
+ | We obtained | ||
+ | :<math>y=ke^{x^3}</math> | ||
+ | as the solution to | ||
+ | :<math>{dy \over dx} = 3x^2y</math> | ||
+ | |||
+ | Differentiating our solution with respect to x, | ||
+ | :<math>{dy \over dx} = 3kx^2e^{x^3}</math> | ||
+ | |||
+ | And since <math>y=ke^{x^3}</math>, we can write | ||
+ | :<math>{dy \over dx} = 3x^2y</math> | ||
+ | We see that we obtain our original differential equation, thus our work must be correct. | ||
+ | |||
+ | === Homogeneous equations === | ||
+ | A ''homogeneous'' equation is in the form | ||
+ | :<math>{dy \over dx} = f(y/x)</math> | ||
+ | |||
+ | This looks difficult as it stands, however we can utilize the substitution | ||
+ | :<math>v = {y \over x}</math> | ||
+ | so that we are now dealing with F(v) rather than F(y/x). | ||
+ | |||
+ | Now we can express y in terms of v, as ''y''=''xv'' and use the product rule. | ||
+ | |||
+ | The equation above then becomes, using the product rule | ||
+ | :<math>{dy \over dx} = v+x{dv \over dx}</math> | ||
+ | |||
+ | Then | ||
+ | :<math>v+x{dv \over dx} = f(v)</math> | ||
+ | :<math>x{dv \over dx} = f(v)-v</math> | ||
+ | :<math>{dv \over dx} = {f(v)-v \over x}</math> | ||
+ | which is a separable equation and can be solved as above. | ||
+ | |||
+ | However let's look at a worked equation to see how homogeneous equations are solved. | ||
+ | |||
+ | ==== Worked example ==== | ||
+ | We have the equation | ||
+ | :<math> {dy \over dx} = {y^2 + x^2 \over yx}</math> | ||
+ | |||
+ | This does not appear to be immediately separable, but let us expand to get | ||
+ | :<math> {dy \over dx} = {y^2 \over yx} + {x^2 \over yx}</math> | ||
+ | :<math> {dy \over dx} = {x \over y} + {y \over x}</math> | ||
+ | |||
+ | Substituting ''y''=''xv'' which is the same as substituting ''v''=''y''/''x'': | ||
+ | :<math> {dy \over dx} = 1/v + v</math> | ||
+ | |||
+ | Now | ||
+ | :<math> v+x{dv \over dx} = 1/v + v</math> | ||
+ | Canceling ''v'' from both sides | ||
+ | :<math> x{dv \over dx} = 1/v</math> | ||
+ | Separating | ||
+ | :<math> v\, dv = dx/x</math> | ||
+ | Integrating both sides | ||
+ | :<math> {1 \over 2}v^2+C= \ln(x) \,</math> | ||
+ | :<math> {1 \over 2}\left({y \over x}\right)^2= \ln(x)-C</math> | ||
+ | :<math> y^2 = 2x^2 \ln(x) - 2Cx^2 \,</math> | ||
+ | :<math> y = x\sqrt{2 \ln(x) - 2C}</math> | ||
+ | |||
+ | which is our desired solution. | ||
+ | |||
+ | === Linear equations === | ||
+ | A linear first order differential equation is a differential equation in the form | ||
+ | :<math> a(x){dy \over dx} + b(x)y=c(x)</math> | ||
+ | |||
+ | Multiplying or dividing this equation by any non-zero function of ''x'' makes no difference to its solutions so we could always divide by ''a''(''x'') to make the coefficient of the differential 1, but writing the equation in this more general form may offer insights. | ||
+ | |||
+ | At first glance, it is not possible to integrate the left hand side, but there is one special case. If ''b'' happens to be the differential of ''a'' then we can write | ||
+ | |||
+ | :<math>a(x){dy \over dx} + b(x)y = a(x){dy \over dx} + y{da \over dx} | ||
+ | = {d \over dx}a(x)y </math> | ||
+ | |||
+ | and integration is now straightforward. | ||
+ | |||
+ | Since we can freely multiply by any function, lets see if we can use this freedom to write the left hand side in this special form. | ||
+ | |||
+ | We multiply the entire equation by an arbitrary, ''I''(''x''), getting | ||
+ | |||
+ | :<math> aI{dy \over dx} + bIy=cI</math> | ||
+ | |||
+ | then impose the condition | ||
+ | |||
+ | :<math> \frac{d}{dx}aI = bI </math> | ||
+ | |||
+ | If this is satisfied the new left hand side will have the special form. Note that multiplying ''I'' by any constant will leave this condition still satisfied. | ||
+ | |||
+ | Rearranging this condition gives | ||
+ | |||
+ | :<math> \frac{1}{I}\frac{dI}{dx} = \frac{b-\frac{da}{dx}}{a} </math> | ||
+ | |||
+ | We can integrate this to get | ||
+ | |||
+ | :<math> \ln I(x) = \int \frac{b(z)}{a(z)}dz - \ln a(x) + c \quad | ||
+ | I(x)=\frac{k}{a(x)}e^{\int \frac{b(z)}{a(z)}dz}</math> | ||
+ | |||
+ | We can set the constant ''k'' to be 1, since this makes no difference. | ||
+ | |||
+ | Next we use ''I'' on the original differential equation, getting | ||
+ | |||
+ | :<math> e^{\int \frac{b(z)}{a(z)}dz}{dy \over dx} + | ||
+ | e^{\int \frac{b(z)}{a(z)}dz} \frac{b(x)}{a(x)}y | ||
+ | =e^{\int \frac{b(z)}{a(z)}dz}\frac{c(x)}{a(x)}</math> | ||
+ | |||
+ | Because we've chosen ''I'' to put the left hand side in the special form we can | ||
+ | rewrite this as | ||
+ | |||
+ | :<math> {d \over dx}(ye^{\int \frac{b(z)}{a(z)}dz}) = | ||
+ | e^{\int \frac{b(z)}{a(z)}dz}\frac{c(x)}{a(x)}</math> | ||
+ | |||
+ | Integrating both sides and dividing by <math>e^I</math> we obtain the final result | ||
+ | |||
+ | :<math> y = e^{-\int \frac{b(z)}{a(z)}dz} | ||
+ | \left(\int e^{\int \frac{b(z)}{a(z)}dz}\frac{c(x)}{a(x)}dx + C\right) | ||
</math> | </math> | ||
− | |||
− | + | We call ''I'' an ''integrating factor''. Similar techniques can be used on some other calculus problems. | |
+ | |||
+ | ====Example==== | ||
+ | |||
+ | Consider | ||
− | + | :<math>\frac{dy}{dx} + y \tan x = 1 \quad y(0)=0</math> | |
− | + | First we calculate the integrating factor. | |
− | + | :<math>I=e^{\int \tan x dx} = e^ {\ln \sec x} = \sec x </math> | |
− | + | Multiplying the equation by this gives | |
− | |||
− | + | :<math>\sec x \frac{dy}{dx} + y \sec x \tan x = \sec x </math> | |
− | + | or | |
− | |||
− | + | :<math> \frac{d}{dx} y\sec x = \sec x </math> | |
− | + | We can now integrate | |
− | == | + | :<math> y = \cos x \int_0^x \sec z \, dz = \cos x \ln (\sec x + \tan x) </math> |
− | |||
− | === | + | === Exact equations === |
− | An | + | An exact equation is in the form |
+ | : f(''x'', ''y'') d''x'' + g(''x'', ''y'') d''y'' = 0 | ||
+ | and, has the property that | ||
+ | : D<sub>x</sub> f = D<sub>y</sub> g | ||
+ | (If the differential equation does not have this property then we can't proceed any further). | ||
− | + | As a result of this, if we have an exact equation then there exists a function h(''x'', ''y'') such that | |
+ | : D<sub>y</sub> h = f and D<sub>x</sub> h = g | ||
− | + | So then the solutions are in the form | |
+ | : h(''x'', ''y'') = c | ||
+ | by using the fact of the total differential. | ||
+ | We can find then h(''x'', ''y'') by integration | ||
− | + | <!-- === Worked example === | |
+ | Consider the differential equation | ||
+ | : (3''x''<sup>2</sup> + 6''y''<sup>2</sup>) d''x'' + ( (3''x''<sup>2</sup> + 6''y''<sup>2</sup>+4''y'') d''y'' | ||
− | == | + | It is exact since |
+ | : D<sub>x</sub> (3''x''<sup>2</sup> + 6''y''<sup>2</sup>) = 6''x'' | ||
+ | : D<sub>y</sub> (3''x''<sup>2</sup> + 6''y''<sup>2</sup>+4''y'') = 6''x'' | ||
− | + | Now, there exists a function h such that | |
+ | : 1) D<sub>x</sub> h = f = (3''x''<sup>2</sup> + 6''y''<sup>2</sup>) | ||
+ | : 2) D<sub>y</sub> h = g = (3''x''<sup>2</sup> + 6''y''<sup>2</sup>+4''y'') | ||
− | + | Integrate D<sub>x</sub> h, with treating ''y'' as a constant: | |
+ | : h(''x'', ''y'') = 2''y''<sup>3</sup>+3''x''<sup>2</sup>''y''+r(''y'') | ||
+ | (We have the function r(''y'') because on differentiating with respect to ''x'' of the above expression, r(''y'') disappears - this is the similar procedure of adding an arbitrary constant) | ||
− | === | + | So now, |
+ | : D<sub>y</sub> h = 3''x''<sup>2</sup>+6''y''<sup>2</sup>+r'(x) | ||
+ | Comparing with (2), we see r'(''y'')=4''y'', so r(''y'')=2''y''<sup>2</sup>+''C'' | ||
− | + | So substituting above, we get | |
+ | : h(''x'', ''y'')2''y''<sup>3</sup>+3''x''<sup>2</sup>''y''+2''y''<sup>2</sup>+''C'' = ''C''<sub>1</sub> | ||
+ | where ''C''<sub>1</sub> is a constant, and our most general solution is then | ||
+ | : 2''y''<sup>3</sup>+3''x''<sup>2</sup>''y''+2''y''<sup>2</sup>=''k'' | ||
+ | and we have simply moved the two constants to the one side of the expression and made this one constant | ||
+ | --> | ||
− | + | ==Basic second and higher order ODE's== | |
− | + | The generic solution of a ''n''<sup>th</sup> order ODE will contain ''n'' constants of integration. To calculate them we need ''n'' more equations. | |
− | + | Most often, we have either | |
+ | :boundary conditions, the values of ''y'' and its derivatives take for two different values of ''x'' | ||
+ | or | ||
+ | :initial conditions, the values of ''y'' and its first ''n-1'' derivatives take for one particular value of ''x''. | ||
− | === | + | ===Reducible ODE's=== |
− | + | 1. If the independent variable, ''x'', does not occur in the differential equation then its order can be lowered by one. This will reduce a second order ODE to first order. | |
− | + | Consider the equation: | |
+ | :<math>F\left(y,\frac{dy}{dx},\frac{d^2y}{dx^2}\right)=0</math> | ||
+ | Define | ||
+ | :<math>u=\frac{dy}{dx}</math> | ||
+ | Then | ||
+ | :<math>\frac{d^2y}{dx^2}=\frac{du}{dx}=\frac{du}{dy}\cdot\frac{dy}{dx}=\frac{du}{dy}\cdot u</math> | ||
+ | Substitute these two expression into the equation and we get | ||
+ | :<math>F\left(y,u,\frac{du}{dy}\cdot u\right)</math>=0 | ||
+ | which is a first order ODE | ||
− | + | ====Example==== | |
+ | Solve | ||
+ | :<math>1+2y^2\operatorname{D}^2y=0</math> | ||
+ | if at ''x''=0, ''y''=D''y''=1 | ||
− | + | First, we make the substitution, getting | |
+ | :<math>1+2y^2 u \frac{du}{dy}=0</math> | ||
+ | This is a first order ODE. | ||
+ | By rearranging terms we can separate the variables | ||
+ | :<math>udu=-\frac{dy}{2y^2}</math> | ||
+ | Integrating this gives | ||
+ | :<math>u^2/2=c+1/2y</math> | ||
+ | We know the values of ''y'' and ''u'' when ''x''=0 so we can find ''c'' | ||
+ | :<math>c=u^2/2-1/2y=1^2/2-1/(2\cdot 1)=1/2-1/2=0</math> | ||
+ | Next, we reverse the substitution | ||
+ | :<math>\frac{dy}{dx}^2=u^2=\frac{1}{y}</math> | ||
+ | and take the square root | ||
+ | :<math>\frac{dy}{dx}=\pm \frac{1}{\sqrt{y}}</math> | ||
+ | To find out which sign of the square root to keep, we use the initial condition, D''y''=1 at ''x''=0, again, and rule out the negative square root. | ||
+ | We now have another separable first order ODE, | ||
+ | :<math>\frac{dy}{dx}=\frac{1}{\sqrt{y}}</math> | ||
+ | Its solution is | ||
+ | :<math>\frac{2}{3}y^\frac{3}{2}= x+d</math> | ||
+ | Since ''y''=1 when ''x''=0, ''d''=2/3, and | ||
+ | :<math>y=\left(1 + \frac{3x}{2} \right)^\frac{2}{3}</math> | ||
− | + | 2. If the dependent variable, ''y'', does not occur in the differential equation then it may also be reduced to a first order equation. | |
− | + | Consider the equation: | |
+ | :<math>F\left(x,\frac{dy}{dx},\frac{d^2y}{dx^2}\right)=0</math> | ||
+ | Define | ||
+ | :<math>u=\frac{dy}{dx}</math> | ||
+ | Then | ||
+ | :<math>\frac{d^2y}{dx^2}=\frac{du}{dx}</math> | ||
+ | Substitute these two expressions into the first equation and we get | ||
+ | :<math>F\left(x,u,\frac{du}{dx}\right)</math>=0 | ||
+ | which is a first order ODE | ||
− | + | ===Linear ODEs=== | |
+ | An ODE of the form | ||
+ | :<math>\frac{d^ny}{dx^n}+a_1(x)\frac{d^{n-1}y}{dx^{n-1}}+ ... +a_n y=F(x)</math> | ||
+ | is called '''linear'''. Such equations are much simpler to solve than typical non-linear ODEs. Though only a few special cases can be solved exactly in terms of elementary functions, there is much that can be said about the solution of a generic linear ODE. A full account would be beyond the scope of this book <!-- This book covers up to 1st year undergraduate, per intro. Save special functions (Bessel, Legendre etc), Sturm-Liouville problem, eigenfunctions, orthonormal bases, etc for a later book --> | ||
− | |||
− | + | If ''F(x)=0'' for all ''x'' the ODE is called '''homogeneous''' | |
− | + | Two useful properties of generic linear equations are | |
+ | #Any linear combination of solutions of an homogeneous linear equation is also a solution. | ||
+ | #If we have a solution of a nonhomogeneous linear equation and we add any solution of the corresponding homogenous linear equation we get another solution of the nonhomogeneous linear equation | ||
− | + | ====Variation of constants==== | |
− | + | Suppose we have a linear ODE, | |
+ | :<math>\frac{d^ny}{dx^n}+a_1(x)\frac{d^{n-1}y}{dx^{n-1}}+ ... +a_n y=0</math> | ||
+ | and we know one solution, ''y=w(x)'' | ||
− | + | The other solutions can always be written as ''y=wz''. This substitution in the ODE will give us terms involving every differential of ''z'' upto the ''n''<sup>th</sup>, no higher, so we'll end up with an ''n''<sup>th</sup> order linear ODE for ''z''. | |
− | + | We know that ''z'' is constant is one solution, so the ODE for ''z'' must not contain a ''z'' term, which means it will effectively be an ''n-1''<sup>th</sup> order linear ODE. We will have reduced the order by one. | |
− | + | Lets see how this works in practice. | |
− | + | =====Example===== | |
− | + | Consider | |
+ | :<math>\frac{d^2y}{dx^2}+\frac{2}{x}\frac{dy}{dx}-\frac{6}{x^2}y=0</math> | ||
− | + | One solution of this is ''y=x<sup>2</sup>'', so substitute ''y=zx<sup>2</sup>'' into this equation. | |
− | = | + | :<math>\left( x^2\frac{d^2z}{dx^2}+4x\frac{dz}{dx}+2z\right) |
+ | +\frac{2}{x} \left( x^2\frac{dz}{dx}+2xz \right) -\frac{6}{x^2}x^2 z=0</math> | ||
− | + | Rearrange and simplify. | |
+ | :<math>x^2 D^2 z + 6xD z=0</math> | ||
+ | This is first order for D''z''. We can solve it to get | ||
+ | :<math>z=A x^{-5} \quad y=A x^{-3}</math> | ||
− | + | Since the equation is linear we can add this to any multiple of the other solution to get the general solution, | |
− | + | :<math>y=A x^{-3} + B x^2</math> | |
− | :<math> | + | ====Linear homogeneous ODE's with constant coefficients==== |
− | + | ||
− | </ | + | Suppose we have a ODE |
− | + | :<math> (D^n+a_1 D^{n-1}+ ... + a_{n-1}D+a_0)y=0</math> | |
− | :<math> | + | we can take an inspired guess at a solution (motivate this) |
− | y | + | :<math>y=e^{px}</math> |
− | </math> | + | For this function D<sup>n</sup>''y''=p<sup>n</sup>y so the ODE becomes |
+ | :<math> (p^n+a_1 p^{n-1}+ ... + a_{n-1}p+a_0)y=0</math> | ||
+ | |||
+ | ''y=0'' is a trivial solution of the ODE so we can discard it. We are then left with the equation | ||
+ | :<math> p^n+a_1 p^{n-1}+ ... + a_{n-1}p+a_0)=0</math> | ||
+ | This is called the ''characteristic'' equation of the ODE. | ||
+ | |||
+ | It can have up to ''n'' roots, p<sub>1</sub>, p<sub>2</sub> … p<sub>n</sub>, each root giving us a different solution of the ODE. | ||
+ | |||
+ | Because the ODE is linear, we can add all those solution together in any linear combination to get a general solution | ||
+ | :<math>y=A_1 e^{p_1 x} +A_2 e^{p_2 x} + ... + A_n e^{p_n x}</math> | ||
+ | |||
+ | To see how this works in practice we will look at the second order case. Solving equations like this of higher order uses exactly the same principles; only the algebra is more complex. | ||
+ | |||
+ | =====Second order===== | ||
+ | |||
+ | If the ODE is second order, | ||
+ | :<math>D^2 y + bDy+cy=0</math> | ||
+ | then the characteristic equation is a quadratic, | ||
+ | :<math>p^2+bp+c=0</math> | ||
+ | with roots | ||
+ | :<math>p_{\pm}=\frac{-b \pm \sqrt{b^2-4c}}{2}</math> | ||
+ | |||
+ | What these roots are like depends on the sign of ''b''<sup>2</sup>-4''c'', so we have three cases to consider. | ||
+ | |||
+ | ''1) b<sup>2</sup> > 4c'' | ||
+ | |||
+ | In this case we have two different real roots, so we can write down the solution straight away. | ||
+ | :<math> y=A_{+}e^{p_{+}}+A_{-}e^{p_{-}}</math> | ||
+ | |||
+ | |||
+ | ''2) b<sup>2</sup> < 4c'' | ||
+ | |||
+ | In this case, both roots are imaginary. We could just put them directly in the formula, but if we are interested in real solutions it is more useful to write them another way. | ||
+ | |||
+ | Defining k<sup>2</sup>=4c-b<sup>2</sup>, then the solution is | ||
+ | :<math>y=A_{+}e^{ikx-\frac{bx}{2}}+A_{-}e^{-ikx-\frac{bx}{2}}</math> | ||
+ | |||
+ | For this to be real, the ''A''<nowiki>'</nowiki>s must be complex conjugates | ||
+ | :<math>A_{\pm}=A e^{\pm ia}</math> | ||
+ | |||
+ | Make this substitution and we can write, | ||
+ | :<math>y=A e^{-bx/2}\cos (kx+a)</math> | ||
+ | |||
+ | If ''b'' is positive, this is a damped oscillation. | ||
+ | |||
+ | |||
+ | ''3) b<sup>2</sup> = 4c'' | ||
+ | |||
+ | In this case the characteristic equation only gives us one root, ''p=-b/2''. We must use another method to find the other solution. | ||
+ | |||
+ | We'll use the method of variation of constants. The ODE we need to solve is, | ||
+ | :<math>D^2 y -2pDy+p^2y=0</math> | ||
+ | rewriting ''b'' and ''c'' in terms of the root. From the characteristic equation we know one solution is <math>y=e^{px}</math> so we make the substitution <math>y=ze^{px}</math>, giving | ||
+ | :<math> (e^{px}D^2z+2pe^{px}Dz+p^2e^{px}z)-2p(e^{px}Dz+pe^{px}z)+p^2e^{px}z=0 </math> | ||
+ | This simplifies to D<sup>2</sup>''z''=0, which is easily solved. We get | ||
+ | :<math>z=Ax+B \quad y=(Ax+B)e^{px}</math> | ||
+ | so the second solution is the first multiplied by ''x''. | ||
+ | |||
+ | Higher order linear constant coefficient ODE's behave similarly: an exponential for every real root of the characteristic and a exponent multiplied by a trig factor for every complex conjugate pair, both being multiplied by a polynomial if the root is repeated. | ||
+ | |||
+ | E.g., if the characteristic equation factors to | ||
+ | :<math>(p-1)^4(p-3)(p^2+1)^2=0</math> | ||
+ | the general solution of the ODE will be | ||
+ | :<math>y=(A+Bx+Cx^2+Dx^3)e^x + Ee^{3x}+ F \cos (x+a) +Gx \cos(x+b)</math> | ||
+ | |||
+ | The most difficult part is finding the roots of the characteristic equation. | ||
+ | |||
+ | ====Linear nonhomogeneous ODEs with constant coefficients==== | ||
+ | |||
+ | First, let's consider the ODE | ||
+ | :<math>Dy-y=x</math> | ||
+ | a nonhomogeneous first order ODE which we know how to solve. | ||
+ | |||
+ | Using the integrating factor ''e<sup>-x</sup>'' we find | ||
+ | :<math>y=c e^{-x} +1 -x</math> | ||
− | + | This is the sum of a solution of the corresponding homogeneous equation, and a polynomial. | |
− | + | Nonhomogeneous ODE's of higher order behave similarly. | |
− | + | If we have a single solution, ''y<sub>p</sub>'' of the nonhomogeneous ODE, called a ''particular'' solution, | |
+ | :<math> (D^n+a_1 D^{n-1} + \cdots + a_n)y=F(x)</math> | ||
+ | then the general solution is ''y=y<sub>p</sub>+y<sub>h</sub>'', where ''y<sub>h</sub>'' is the general solution of the homogeneous ODE. | ||
− | + | Find ''y<sub>p</sub>'' for an arbitrary ''F(x)'' requires methods beyond the scope of this chapter, but there are some special cases where finding ''y<sub>p</sub>'' is straightforward. | |
− | + | Remember that in the first order problem ''y<sub>p</sub>'' for a polynomial ''F(x)'' was itself a polynomial of the same order. We can extend this to higher orders. | |
− | + | ''Example:'' | |
+ | :<math>D^2y+y=x^3-x+1</math> | ||
+ | Consider a particular solution | ||
+ | :<math>y_p=b_0+b_1 x+b_2 x^2 + x^3</math> | ||
+ | Substitute for ''y'' and collect coefficients | ||
+ | :<math>x^3 + b_2 x^2 +(6+b_1)x +(2b_2+b_0)=x^3-x+1</math> | ||
+ | So ''b<sub>2</sub>=0'', ''b<sub>1</sub>=-7'', ''b<sub>0</sub>=1'', and the general solution is | ||
+ | :<math>y=a \sin x + b \cos x + 1 -7x + x^3</math> | ||
− | + | This works because all the derivatives of a polynomial are themselves polynomials. | |
− | == | + | Two other special cases are |
− | + | :<math>F(x)=P_n e^{kx} \quad y_p(x)=Q_n e^{kx}</math> | |
− | + | :<math>F(x)=A_n \sin kx +B_n \cos kx \quad | |
− | + | y_p(x)=P_n \sin kx +Q_n \cos kx</math> | |
+ | where ''P<sub>n</sub>'',''Q<sub>n</sub>'',''A<sub>n</sub>'', and ''B<sub>n</sub>'' are all polynomials of degree ''n''. | ||
− | + | Making these substitutions will give a set of simultaneous linear equations for the coefficients of the polynomials. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Revision as of 13:36, 15 October 2021
Ordinary differential equations involve equations containing:
- variables
- functions
- their derivatives
and their solutions.
In studying integration, you already have considered solutions to very simple differential equations. For example, when you look to solving
for g(x), you are really solving the differential equation
Contents
Notations and terminology
The notations we use for solving differential equations will be crucial in the ease of solubility for these equations.
This document will be using three notations primarily:
- f' to denote the derivative of f
- D f to denote the derivative of f
- to denote the derivative of f (for separable equations).
Terminology
Consider the differential equation
Since the equation's highest derivative is 2, we say that the differential equation is of order 2.
Some simple differential equations
A key idea in solving differential equations will be that of integration.
Let us consider the second order differential equation (remember that a function acts on a value).
How would we go about solving this? It tells us that on differentiating twice, we obtain the constant 2 so, if we integrate twice, we should obtain our result.
Integrating once first of all:
We have transformed the apparently difficult second order differential equation into a rather simpler one, viz.
This equation tells us that if we differentiate a function once, we get . If we integrate once more, we should find the solution.
This is the solution to the differential equation. We will get for all values of and .
The values and are related to quantities known as initial conditions.
Why are initial conditions useful? ODEs (ordinary differential equations) are useful in modeling physical conditions. We may wish to model a certain physical system which is initially at rest (so one initial condition may be zero), or wound up to some point (so an initial condition may be nonzero, say 5 for instance) and we may wish to see how the system reacts under such an initial condition.
When we solve a system with given initial conditions, we substitute them after our process of integration.
Example
When we solved say we had the initial conditions and . (Note, initial conditions need not occur at f(0)).
After we integrate we make substitutions:
Without initial conditions, the answer we obtain is known as the general solution or the solution to the family of equations. With them, our solution is known as a specific solution.
Basic first order DEs
In this section we will consider four main types of differential equations:
- separable
- homogeneous
- linear
- exact
There are many other forms of differential equation, however, and these will be dealt with in the next section
Separable equations
A separable equation is in the form (using dy/dx notation which will serve us greatly here)
Previously we have only dealt with simple differential equations with g(y)=1. How do we solve such a separable equation as above?
We group x and dx terms together, and y and dy terms together as well.
Integrating both sides with respect to y on the left hand side and x on the right hand side:
we will obtain the solution.
Worked example
Here is a worked example illustrating the process.
We are asked to solve
Separating
Integrating
Letting where k is a constant we obtain
which is the general solution.
Verification
This step does not need to be part of your work, but if you want to check your solution, you can verify your answer by differentiation.
We obtained
as the solution to
Differentiating our solution with respect to x,
And since , we can write
We see that we obtain our original differential equation, thus our work must be correct.
Homogeneous equations
A homogeneous equation is in the form
This looks difficult as it stands, however we can utilize the substitution
so that we are now dealing with F(v) rather than F(y/x).
Now we can express y in terms of v, as y=xv and use the product rule.
The equation above then becomes, using the product rule
Then
which is a separable equation and can be solved as above.
However let's look at a worked equation to see how homogeneous equations are solved.
Worked example
We have the equation
This does not appear to be immediately separable, but let us expand to get
Substituting y=xv which is the same as substituting v=y/x:
Now
Canceling v from both sides
Separating
Integrating both sides
which is our desired solution.
Linear equations
A linear first order differential equation is a differential equation in the form
Multiplying or dividing this equation by any non-zero function of x makes no difference to its solutions so we could always divide by a(x) to make the coefficient of the differential 1, but writing the equation in this more general form may offer insights.
At first glance, it is not possible to integrate the left hand side, but there is one special case. If b happens to be the differential of a then we can write
and integration is now straightforward.
Since we can freely multiply by any function, lets see if we can use this freedom to write the left hand side in this special form.
We multiply the entire equation by an arbitrary, I(x), getting
then impose the condition
If this is satisfied the new left hand side will have the special form. Note that multiplying I by any constant will leave this condition still satisfied.
Rearranging this condition gives
We can integrate this to get
We can set the constant k to be 1, since this makes no difference.
Next we use I on the original differential equation, getting
Because we've chosen I to put the left hand side in the special form we can rewrite this as
Integrating both sides and dividing by we obtain the final result
We call I an integrating factor. Similar techniques can be used on some other calculus problems.
Example
Consider
First we calculate the integrating factor.
Multiplying the equation by this gives
or
We can now integrate
Exact equations
An exact equation is in the form
- f(x, y) dx + g(x, y) dy = 0
and, has the property that
- Dx f = Dy g
(If the differential equation does not have this property then we can't proceed any further).
As a result of this, if we have an exact equation then there exists a function h(x, y) such that
- Dy h = f and Dx h = g
So then the solutions are in the form
- h(x, y) = c
by using the fact of the total differential. We can find then h(x, y) by integration
Basic second and higher order ODE's
The generic solution of a nth order ODE will contain n constants of integration. To calculate them we need n more equations. Most often, we have either
- boundary conditions, the values of y and its derivatives take for two different values of x
or
- initial conditions, the values of y and its first n-1 derivatives take for one particular value of x.
Reducible ODE's
1. If the independent variable, x, does not occur in the differential equation then its order can be lowered by one. This will reduce a second order ODE to first order.
Consider the equation:
Define
Then
Substitute these two expression into the equation and we get
- =0
which is a first order ODE
Example
Solve
if at x=0, y=Dy=1
First, we make the substitution, getting
This is a first order ODE. By rearranging terms we can separate the variables
Integrating this gives
We know the values of y and u when x=0 so we can find c
Next, we reverse the substitution
and take the square root
To find out which sign of the square root to keep, we use the initial condition, Dy=1 at x=0, again, and rule out the negative square root. We now have another separable first order ODE,
Its solution is
Since y=1 when x=0, d=2/3, and
2. If the dependent variable, y, does not occur in the differential equation then it may also be reduced to a first order equation.
Consider the equation:
Define
Then
Substitute these two expressions into the first equation and we get
- =0
which is a first order ODE
Linear ODEs
An ODE of the form
is called linear. Such equations are much simpler to solve than typical non-linear ODEs. Though only a few special cases can be solved exactly in terms of elementary functions, there is much that can be said about the solution of a generic linear ODE. A full account would be beyond the scope of this book
If F(x)=0 for all x the ODE is called homogeneous
Two useful properties of generic linear equations are
- Any linear combination of solutions of an homogeneous linear equation is also a solution.
- If we have a solution of a nonhomogeneous linear equation and we add any solution of the corresponding homogenous linear equation we get another solution of the nonhomogeneous linear equation
Variation of constants
Suppose we have a linear ODE,
and we know one solution, y=w(x)
The other solutions can always be written as y=wz. This substitution in the ODE will give us terms involving every differential of z upto the nth, no higher, so we'll end up with an nth order linear ODE for z.
We know that z is constant is one solution, so the ODE for z must not contain a z term, which means it will effectively be an n-1th order linear ODE. We will have reduced the order by one.
Lets see how this works in practice.
Example
Consider
One solution of this is y=x2, so substitute y=zx2 into this equation.
Rearrange and simplify.
This is first order for Dz. We can solve it to get
Since the equation is linear we can add this to any multiple of the other solution to get the general solution,
Linear homogeneous ODE's with constant coefficients
Suppose we have a ODE
we can take an inspired guess at a solution (motivate this)
For this function Dny=pny so the ODE becomes
y=0 is a trivial solution of the ODE so we can discard it. We are then left with the equation
This is called the characteristic equation of the ODE.
It can have up to n roots, p1, p2 … pn, each root giving us a different solution of the ODE.
Because the ODE is linear, we can add all those solution together in any linear combination to get a general solution
To see how this works in practice we will look at the second order case. Solving equations like this of higher order uses exactly the same principles; only the algebra is more complex.
Second order
If the ODE is second order,
then the characteristic equation is a quadratic,
with roots
What these roots are like depends on the sign of b2-4c, so we have three cases to consider.
1) b2 > 4c
In this case we have two different real roots, so we can write down the solution straight away.
2) b2 < 4c
In this case, both roots are imaginary. We could just put them directly in the formula, but if we are interested in real solutions it is more useful to write them another way.
Defining k2=4c-b2, then the solution is
For this to be real, the A's must be complex conjugates
Make this substitution and we can write,
If b is positive, this is a damped oscillation.
3) b2 = 4c
In this case the characteristic equation only gives us one root, p=-b/2. We must use another method to find the other solution.
We'll use the method of variation of constants. The ODE we need to solve is,
rewriting b and c in terms of the root. From the characteristic equation we know one solution is so we make the substitution , giving
This simplifies to D2z=0, which is easily solved. We get
so the second solution is the first multiplied by x.
Higher order linear constant coefficient ODE's behave similarly: an exponential for every real root of the characteristic and a exponent multiplied by a trig factor for every complex conjugate pair, both being multiplied by a polynomial if the root is repeated.
E.g., if the characteristic equation factors to
the general solution of the ODE will be
The most difficult part is finding the roots of the characteristic equation.
Linear nonhomogeneous ODEs with constant coefficients
First, let's consider the ODE
a nonhomogeneous first order ODE which we know how to solve.
Using the integrating factor e-x we find
This is the sum of a solution of the corresponding homogeneous equation, and a polynomial.
Nonhomogeneous ODE's of higher order behave similarly.
If we have a single solution, yp of the nonhomogeneous ODE, called a particular solution,
then the general solution is y=yp+yh, where yh is the general solution of the homogeneous ODE.
Find yp for an arbitrary F(x) requires methods beyond the scope of this chapter, but there are some special cases where finding yp is straightforward.
Remember that in the first order problem yp for a polynomial F(x) was itself a polynomial of the same order. We can extend this to higher orders.
Example:
Consider a particular solution
Substitute for y and collect coefficients
So b2=0, b1=-7, b0=1, and the general solution is
This works because all the derivatives of a polynomial are themselves polynomials.
Two other special cases are
where Pn,Qn,An, and Bn are all polynomials of degree n.
Making these substitutions will give a set of simultaneous linear equations for the coefficients of the polynomials.