An ordinary differential equation is an equation that connects a function of x with derivatives of that function, for example d²y/dx²=2x²+3.
The order of a differential equation is determined by its highest derivative, and the degree of the equation is the power to which the highest derivative is raised. For example, the equation x(d³y/dx³)²+3(dy/dx)=0 has order 3 and degree 2.
Linear differential equations are equations in which the dependent variable y and its derivatives are not raised to powers or do not occur either in non-linear functions such as sin y and cosh y or as products.
Homogeneous equations only contain terms involving y, for example (d²y/dx²)+2(dy/dx)+y=0. Non-homogeneous equations, on the other hand, contain at least one term that does not involve y, for example (d²y/dx²)+2(dy/dx)+y=x².
The general solution of an nth order differential equation contains n arbitrary constants, for example (d²y/dx²)+w²y=0. We normally have n conditions on the solution in order to enable us to calculate the n constants, leading to a particular solution. The conditions may be initial conditions or boundary conditions.
As an example of an initial value problem, consider the equation d²s/dt²=g, where s=s(t). When t=0, s=0 and ds/dt=u. g is a constant. The equation is a second order differential equation. Integrating gives ds/dt=gt+A. When t=0, A=ds/dt=u. Therefore, ds/dt=gt+u. Integrating this gives s=ut+0.5gt²+B. When s=0, t=0 and B=0. Therefore, s=ut+0.5gt². This is the particular solution. The general solution is s=0.5gt²+At+B.
As an example of a boundary value problem, consider the equation d²y/dx²=2x²+3 and the constraints y(0)=1 and y(1)=-2. Integrating the equation gives dy/dx=(2/3)x³+3x+A, and integrating again gives y=x4/6+1.5x²+Ax+B. When x=0, y=1; therefore, B=1. And when x=1, y=-2; this leads to -2=(1/6)+1.5+A+1, which simplifies to A=-42/3.
It may be possible to solve first order differential equations by separation of variables. If dy/dx=f(x,y), look for y as a function of x alone. If the equation can be rewritten in the form g(y)(dy/dx)=h(x), it is separable. Integrating the rearranged equation gives ∫ g(y) (dy/dx) dx = ∫ h(x) dx; this leads to ∫ g(y) dy = ∫ h(x) dx. If we can perform these integrations, the problem can be solved.
As an example, find the general solution of dy/dx+ky=0, and use it to solve for y when y(1)=3. The equation is a first order equation, so we need one constant of integration. Rearranging the equation gives (1/y)(dy/dx)=-k. Integrating this gives ∫ (1/y)(dy/dx) dx = ∫ -k dx, which leads to ln y = -kx + c. Rearranging this produces y=ece-kx. If A=ec, then y=Ae-kx.
Consider an equation of the form p(x,y)(dy/dx)+q(x,y)=0. If it can be written in the form dh/dx=0, where h=h(x,y), it is an exact first order differential equation. Then the equation can be written in the form h(x,y)=A and solved. Because h=h(x,y), dh/dx=(dh/dx)(dx/dx)+(dh/dy)(dy/dx)=dh/dx+(dh/dy)(dy/dx), where y=y(x). Rearranging this gives (dh/dy)(dy/dx)+dh/dx=0, and comparing this with the original equation gives p(x,y)=dh/dy and q(x,y)=dh/dx. If h exists, ∂p/∂x=∂²h/∂x∂y=∂q/∂y and the equation can be solved.
To find h, first examine the equation to see whether it can be written as dh/dx=0. If it cannot, start with the equations ∂h/∂y=p(x,y) and ∂h/∂x=q(x,y). Integrating these gives h(x,y) = ∫ p(x,y) dy + α(x) and h(x,y) = ∫ q(x,y) dx + β(y). Then find α and β.
To take an example, let us find the general solution of 2xy(dy/dx)+y²-2x=0. p(x,y)=2xy and q(x,y)=y²-2x. Therefore, ∂p/∂x=2y and ∂q/∂y=2y. By inspection, (d/dx)(xy²-x²)=0; therefore, h(x,y)=xy²-x². Using the second method of finding h, we obtain ∂h/∂y=p(x,y)=2xy and ∂h/∂x=q(x,y)=y²-2x. Integrating these equations gives h(x,y)=xy²+α(x) and h(x,y)=xy²-x²+β(y). Therefore, h(x,y)=xy²+α(x)=xy²-x²+β(y). Comparing the equations for h(x,y) shows that α(x)=-x² and β(y)=0. Therefore, h(x,y)=xy²-x². Because dh/dx=0, integrating gives h(x,y)=A, i.e. xy²-x²=A. Rearranging this gives y=±√((A/x)+x).
Linear first order differential equations of the form a(x)dy/dx+b(x)y=c(x) can be solved with the help of an integrating factor. Start by rewriting the equation in standard form, i.e. where the coefficient of dy/dx is 1. This gives dy/dx+p(x)y=q(x), where p(x)=b(x)/a(x) and q(x)=c(x)/a(x). Multiplying this by an integrating factor μ(x) gives μdy/dx+μp(x)y=μq(x). μ(x) is of the form μ(x)=e∫p(x)dx, and is such that the left hand side of the equation is in exact form. (d/dx)(μy)=μq(x). Integrating this then dividing both sides by μ gives y=(A/μ)+(1/μ)∫μ(x)q(x)dx.
As an example, let us find the general solution of x(x-1)dy/dx+2xy=1 for x≥2 and deduce the particular solution subject to y=2 when x=2. Rewriting the equation in standard form gives dy/dx+2y/(x-1)=1/(x(x-1)). The integrating factor μ = e∫ 2/(x-1) dx. Solving this gives μ = e2 ln (x-1) = (x-1)², and multiplying μ by the standard form equation gives (x-1)²dy/dx+2(x-1)y=(x-1)/x. In exact form, (d/dx)(y(x-1)²)=(x-1)²/(x(x-1))=(x-1)/x=1-1/x. Integrating this gives y(x-1)² = ∫ 1-1/x dx = x - ln x + A, and rearranging gives the general solution y=(x - ln x + A)/(x-1)². Because y(2)=2, 2=(2 - ln 2 + A)/(2-1)². Rearranging this gives A = ln 2. The particular solution is therefore y=(x - ln x + ln 2)/(x-1)².
Equations of the form a(d²y/dx²)+b(dy/dx)+cy=0 are termed homogeneous second order linear differential equations. To solve them, try a solution of the form y=Aemx. We can derive the auxiliary equation am²+bm+c=0, where - if I understand correctly - mn=(dny/dxn)/y. The solutions are denoted by m1 and m2. If m1 and m2 are real and unequal, the general solution is y=Aemx+Bemx. If they are real and equal, the general solution is y=(Ax+B)emx. And if they are complex numbers of the form m1=φ+θi and m2=φ-θi, the general solution is y=eφx(A cos θx + B sin θx).
To take an example, let us find the general solution of d²y/dx²-dy/dx-2y=0 and the particular solution satisfying y(0)=0 and y'(0)=1. The auxiliary equation is m²-m-2=0; factorising this gives (m+1)(m-2)=0. The values of m are therefore -1 and 2, in which case the general solution is y=Ae-x+Be2x. Applying the first condition for the particular solution gives 0=A+B. Differentiating the general solution gives dy/dx=-Ae-x+2Be2x. Applying the second condition therefore leads to 1=-A+2B. We therefore have a pair of simultaneous equations which can be solved to give A=-1/3 and B=1/3. The particular solution is therefore y=(e2x-e-x)/3.
Equations of the form a(d²y/dx²)+b(dy/dx)+cy=f(x) are termed non-homogeneous equations. If yp is any particular solution of the equation and yc is the general solution of the corresponding homogeneous equation a(d²y/dx²)+b(dy/dx)+cy=0, the general solution of our non-homogeneous equation is y=yc+yp. Note that yc=αy1+βy2. The two constants of integration are therefore contained in yc. There are no constants of integration in yp.
As an example, let us find the general solution of d²y/dx²-4y=x²-3x-4. Start by finding the complementary function yc; this is the general solution of the corresponding homogeneous equation, namely d²y/dx²-4y=0. The auxiliary equation corresponding to this equation is m²-4=0. Solving this gives m=±2. Therefore, yc=Ae2x+Be-2x. The particular equation yp=px²+qx+r. Substituting this into the non-homogeneous equation gives d²yp/dx²-4yp=x²-3x-4, and substituting for yp and its second derivative gives 2p-4(px²+qx+r)=x²-3x-4. Comparing multiples of powers of x on both sides of this equation shows that -4p=1, -4q=-3 and 2p-4r=-4. The values of p, q and r can therefore be calculated to be -0.25, 0.75 and 0.875 respectively. Therefore, yp=-0.25x²+0.75x+0.875. This is combined with the equation for yc to give the general solution: y=Ae2x+Be-2x-0.25x²+0.75x+0.875.