Classical Mechanics/Differential Equations

Physics - Classical Mechanics

Prev Up Next

A brief primer on differential equations
You may skip this primer and go to the next page if you can easily solve the following differential equations:

$$\frac{dx(t)}{dt}=4x+8t,\quad x(0)=0$$

$$\frac{d^2x(t)}{dt^2}+15x(t)=10,\quad x(0)=1,\quad\dot x(0)=0$$

$$\frac{dx(t)}{dt}=3t\sqrt x,\quad x(0)=1$$

Integration
Integration is the operation which is inverse to differentiation. This operation is very important for theoretical physics, and you should become familiar with computing integrals.

Definite integrals are written as follows: $$\int\limits_a^b f(x)dx$$. (There is really no separate concept of an "indefinite integral." The notation $$\int f(x)dx$$ is merely the shorthand for $$\int\limits_{x_0}^x f(x')dx'$$, where $$x_0$$ is not used in later calculations and/or is chosen for convenience in some natural way.)

Some basic integrals:

$$ \int f(ax)dx=\frac{1}{a}\int f(x)dx;\quad\int t^ndt=\frac{t^{n+1}}{n+1};\quad\int e^xdx=e^x;\quad\int\cos(x)dx=\sin(x); $$$$ \int\frac{dx}{x}=\ln(x);\quad\int\frac{dx}{1+x^{2}}=\arctan(x);\quad\int\frac{dx}{\sqrt{1-x^2}}=\arcsin(x)$$

Substitution of variable: introduce $$x=g(z)$$, where $$g(z)$$ is a function: $$\int f(x)dx=\int f(g(z))\frac{dg(z)}{dz}dz$$ Examples: $$\int\frac{dx}{1+x}=\ln(1+x)$$$$\int\frac{dx}{x^2}\sin\left(\tfrac{1}{x}\right)=\cos\left(\tfrac{1}{x}\right)$$

Integration by parts: $$\int\limits_a^b f(x)g'(x)dx=f(x)g(x)\bigg|_a^b-\int\limits_a^b f'(x)g(x)dx$$ For example, (here we do not write the limits of integration): $$\int\ln(x)dx=\int(x)'\ln(x)dx=x\ln(x)-\int x\ln'(x)dx=x\ln(x)-x$$

Note: trigonometric functions are sometimes more conveniently written in terms of complex exponentials (using the Euler formula): $$\cos(x)=\frac{e^{xi}+e^{-xi}}{2};\quad\sin(x)=\frac{e^{xi}-e^{-xi}}{2i};\quad e^{xi}=\cos(x)+i\sin(x)$$

Exercise: 

Compute the following indefinite integrals. Test yourself!!!!!!
 * $$\int e^{2x}\sin(x)dx=$$
 * $$\int t^2\sin(t)dt=$$
 * $$\int\sin^2(x)dx=$$
 * $$\int\frac{dx}{\sqrt{2x+1}}=$$
 * $$\int x\sqrt{3x+1}dx=$$
 * $$\int \sqrt{\tan(x)}dx=$$

General solutions and particular solutions
In this section, differential equations are written for unknown function $$x(t)$$. Derivatives are denoted by overdots: $$\dot{x}\equiv\frac{dx}{dt}$$, $$\ddot{x}\equiv\frac{d^{2}x}{dt^{2}}$$ , etc.

The general solution of a differential equation is a function that solves the equation and contains arbitrary constants. For equations with first derivatives (first-order equations) there is only one constant; for second-order equations there are two constants, etc.

Examples:

where $$A$$ is an arbitrary constant. This has two solutions, $$\lambda=-1$$ and $$\lambda=-4$$. So the general solution is $$x(t)=Ae^{-t}+Be^{-4t}$$.
 * Find the general solution of the equation $$\dot{x}(t)=0$$ . Answer: $$x(t)=A$$ ,
 * Find the general solution of $$\dot{x}=2$$ . Answer: $$x(t)=A+2t$$.
 * Find the general solution of $$\dot{x}=4t+\cos(2t)$$ . Answer: $$x(t)=A+2t^{2}+\frac{1}{2}\sin2t$$.
 * Find the general solution of $$\dot{x}+x=0$$ . Answer: $$x(t)=Ae^{-t}$$.
 * Find the general solution of the second-order equation $$\ddot{x}=0$$ . Answer: $$x(t)=A+Bt$$.
 * Find the general solution of $$\ddot{x}+7x=0$$ . Answer: $$x(t)=A\cos(t\sqrt7)+B\sin(t\sqrt7)$$.
 * Find the general solution of $$\ddot{x}-7x=0$$ . Answer: $$x(t)=Ae^{t\sqrt7}+Be^{-t\sqrt7}$$.
 * Find the general solution of $$\ddot{x}+5\dot{x}+4x=0$$ . Solution: we look for $$x(t)=Ae^{\lambda t}$$ . Then $$\lambda$$ must be such that $$\lambda^2+5\lambda+4=0$$.

Exercises:

Find the general solution of the following equations.
 * $$\dot x=2x$$
 * $$\ddot{x}=3t+e^{-t}$$
 * $$\ddot{x}=\dot{x}$$
 * $$\ddot{x}=-10x$$
 * $$\ddot{x}=-2006\dot{x}+2006x$$

Particular solutions are selected from general solutions by conditions, such as the initial conditions: $$\ddot{x}=1,\quad x(0)=1,\quad\dot{x}(0)=2.\quad(1)$$ The general solution of $$\ddot{x}=1$$ is $$x(t)=A+Bt+\frac{t^2}{2}$$. The conditions $$x(0)=1$$, $$\dot{x}(0)=2$$ are satisfied only if $$A=1$$ , $$B=2$$. Therefore, the particular solution of equation (1) is $$x(t)=1+2t+\frac{t^2}{2}$$.

To find particular solutions, we first find the general solution with arbitrary constants and then determine the values of these constants using the initial conditions.

Exercises:

Solve the following equations with initial conditions. Plot the resulting functions $$x(t)$$.


 * $$\dot{x}+3x=0,\quad x(0)=2$$
 * $$\dot{x}-x=0,\quad x(2)=1$$
 * $$\ddot{x}-4x=0,\quad x(0)=1,\quad\dot{x}(0)=1$$
 * $$\ddot{x}-4t=0,\quad x(0)=1,\quad\dot{x}(0)=1$$

Boundary-value problems are differential equations with conditions at different points. Note: There are usually infinitely many functions that solve a differential equation. The general solution represents all these functions by means of a formula with arbitrary constants. A particular solution is selected by conditions, and one needs as many conditions as unknown constants. So, e.g. for a second-order differential equation, there are two arbitrary constants, and one needs two conditions to specify a unique solution. Instead of specifying two conditions conditions at the same time, such as $$x(0)=\dot x(0)=0$$, one can specify two conditions at different times, e.g. $$x(0)=1,x(1)=2$$. Such conditions are called boundary conditions.

Exercises:

Solve the following boundary-value problems. Hint: The last two equations have tricky boundary conditions!
 * $$3\ddot{x}+4x=0,\quad x(0)=0,\quad x(2)=5$$
 * $$\ddot{x}=4e^{-t},\quad x(0)=1,\quad x(1)=0$$
 * $$\ddot{x}+4x=0,\quad x(0)=0,\quad x(\pi)=\pi$$
 * $$\ddot{x}+x=0,\quad x(0)=2\pi,\quad x(2\pi)=2\pi$$

Some simple inhomogeneous equations
Equations of the form $$\dot{x}=Bx$$ have the general solution $$x(t)=Ae^{Bt}$$. What about $$\dot{x}=Bx+10$$ ? The general solution is $$x(t)=Ae^{Bx}+\frac{10}{B}$$. How to guess? Write $$x(t)=Ae^{Bt}+C$$ and substitute; then find the correct value of $$C$$.

Exercises:

Solve the following equations.
 * $$\dot x+3x=2,\quad x(0)=1$$
 * $$\ddot{x}+5\dot x+4x=8,\quad x(0)=2,\quad\dot x(0)=0$$
 * $$2\ddot{x}+18x=-1,\quad x(1)=1,\quad\dot x(1)=0$$
 * $$\ddot{x}+9\dot x=-2,\quad x(0)=0,\quad\dot x(0)=3$$

Hint: In the last equation, replace $$\dot x(t)$$ by an unknown function $$v(t)$$.

Similarly, $$\ddot{x}+\omega^2x=0$$ have the general solution $$x(t)=A_1\cos(\omega t)+A_2\sin(\omega t)$$. What about $$\ddot{x}+\omega^2x=A+Bt$$ ? Write $$x(t)=C_1+C_2t$$ and find the correct values of $$C_1$$ and $$C_2$$, then add the general solution. The result is $$x(t)=(A+Bt)\omega^{-2}+A_1\cos(\omega t)+A_2\sin(\omega t)$$.

Note that in every case the general solution of the equation without the right-hand side (the homogeneous equation) is added to a guessed solution of the equation with the right-hand side (the inhomogeneous equation). This is the general principle when dealing with such equations.

Exercises:

Solve the following equations:


 * $$\ddot{x}+2x=3t-1,\quad x(0)=\dot{x}(0)=0$$
 * $$\ddot{x}-4x=t^{2}-4t,\quad x(0)=\dot{x}(0)=0$$
 * $$\ddot{x}+\dot{x}+x=t^3+t^2+t,\quad x(0)=\dot{x}(0)=0$$

Method of "variation of constants"
What about $$\dot{x}=Bx+f(t)$$, where $$f(t)$$ is some more complicated function? These are solved with the method of variation of constants. The solution is found as $$x(t)=A(t)e^{Bt}$$, where $$A(t)$$ is an unknown function. Substituting into $$\dot{x}=Bx+f(t)$$, we have $$\dot{A}e^{Bt}+BAe^{Bt}=BAe^{Bt}+f(t)$$ therefore the function $$A(t)$$ satisfies the equation $$\dot{A}=e^{-Bt}f(t)$$. Its general solution is $$A(t)=\int\limits_{t_0}^t e^{-Bt_1}f(t_1)dt_1$$ where $$t_0$$ is an arbitrary constant. Therefore, the general solution for $$x(t)$$ is $$x(t)=e^{Bt}\int\limits_{t_0}^t e^{-Bt_1}f(t_1)dt_1$$ This can be also rewritten as $$x(t)=Ae^{Bt}+e^{Bt}\int\limits_0^t e^{-Bt_1}f(t_1)dt_1=Ae^{Bt}+\int\limits_0^t e^{B(t-t_1)}f(t_1)dt_1$$ where now $$A$$ is an arbitrary constant.

Example: 

Solve $$\dot{x}+x=t$$. Solution: $$x(t)=A(t)e^{-t}$$ ; the function $$A(t)$$ is found from $$\dot{A}=te^t$$, so $$A(t)=\int te^t dt=te^t-e^t+C$$. So the general solution is $$x(t)=Ae^{-t}=t-1+Ce^{-t}$$. We could guess this solution by substituting $$x(t)=C_1t+C_2+Ae^{-t}$$ and finding the correct values $$C_1$$, $$C_2$$.

Exercises:

Solve the following equations with initial or boundary conditions.


 * $$\dot{x}-2x=3t^{2}-2t,\quad x(0)=1$$
 * $$\dot{x}+2x=e^{-t}\quad x(0)=1$$
 * $$\dot{x}+x=e^{-t}\quad x(0)=1$$

More general equations: $$\dot{x}-f(t)x=0\quad\Rightarrow\quad x=Ae^{\int f(t)dt}$$ For example: $$\dot{x}+2tx=0$$ has the general solution $$x(t)=Ae^{-t^2}$$.

Exercises:

Find the general solution of the following equations.
 * $$\dot{x}+t^2x=0$$
 * $$\dot{x}+e^tx=e^t$$

Another general formula is $$\dot{x}-f(t)x=g(t)\quad\Rightarrow\quad x=Ae^{\int\limits_0^t f(t_1)dt_1}\int\limits_0^t g(t_1)e^{-\int\limits_0^{t_1} f(t_2)dt_2}dt_1$$ This can be obtained by "variation of constant" in the solution $$Ae^{\int f(t)dt}$$.

Method of "separation of variables"
Another useful method applies to differential equations of the form $$\dot{x}=f(x)g(t)$$ For example, the differential equations $$\dot{x}=x^2t^2$$ and $$\sqrt{x}\dot{x}=\cos(t)$$ are of this form. To solve these equations, we use the trick called "separation of variables." We look for the solution of the form $$F(x)=G(t)$$, where $$F$$ and $$G$$ are some functions. If the solution were in this form, then $$\frac{d}{dt}F(x)=\frac{d}{dt}G(t)$$, which is the same as $$(dF/dx)\dot{x}=dG/dt$$. This should be equivalent to the original differential equation $$\dot{x}=f(x)g(t)$$. Therefore, $$\frac{dF(x)}{dx}=\frac{1}{f(x)},\quad\frac{dG(t)}{dt}=g(t)$$ These equations are easy to solve: $$F(x)=\int\frac{dx}{f(x)},\quad G(t)=\int g(t)dt$$ We can compute these functions and find the general solution of the original equation in the following implicit form: $$\int\limits_{x_0}^x \frac{dx}{f(x)}=\int\limits_{t_0}^t g(t)dt$$ Here, $$x_0$$ and $$t_0$$ are arbitrary constants of integration. This solution satisfies the initial condition $$x(t_0)=x_0$$.

Example:

Consider the equation $$\dot{x}=x^2t^2$$. We write $$\frac{\dot{x}}{x^2}=t^2\quad\Rightarrow\quad\int\frac{dx}{x^2}=\int t^2dt\quad\Rightarrow\quad -\frac{1}{x}+C=\frac{t^3}{3}\quad\Rightarrow\quad x(t)=\frac{1}{C-\frac{t^3}{3}}$$ Note that only one constant of integration is necessary, despite the presence of two "indefinite integrals".

Exercises:

Find the general solution of the following equations.
 * $$\dot{x}=\frac{x}{t}$$
 * $$\frac{dy(x)}{dx}=\frac{1+y}{1+x}$$
 * $$\sqrt{x(t)\frac{dx(t)}{dt}}=\frac{1}{5t}$$

Miscellaneous cases when solutions are guessed
One case is second-order equations with "source" (i.e. with nonzero function in the right hand side). We need to guess a solution of the inhomogeneous equation. We guess the solution by writing an ansatz with unknown coefficients. Here are some examples: $$\ddot{x}+x=\cos(2t)\Rightarrow x(t)=C_{1}\cos(2t),\quad\textrm{then~find~}C_1$$

$$\ddot{x}+4\dot{x}+3x=\sin(t)\Rightarrow x(t)=C_1\sin(t)+C_2\cos(t),\quad\textrm{then~find~}C_{1,2}$$

$$\ddot{x}+x=\sin(t)\Rightarrow x(t)=C_1t\cos(t),\quad\textrm{then~find~}C_1$$ Note: in the last example, we need a term $$t\cos t$$ because $$\sin(t)$$ and $$\cos(t)$$ are already solutions of the homogeneous equation!

Another example: $$\ddot{x}+2\dot{x}+x=0$$ We look for solutions in the form $$x(t)=e^{\lambda t}$$, find $$\lambda^2+2\lambda+1=0$$ and only one root $$\lambda=-1$$. Then we use a special trick: the general solution is not $$Ce^{-t}$$ but $$x(t)=C_1e^{-t}+C_2te^{-t}$$.

Exercises:

Solve the following equations.
 * $$\ddot{x}+4x=\sin(t)+1,\quad x(0)=\dot{x}(0)=1$$
 * $$\ddot{x}+4x=\sin(2t)+1,\quad x(0)=\dot{x}(0)=1$$
 * $$\ddot{x}-4\dot{x}+4x=2,\quad x(0)=\dot{x}(0)=1$$

Systems of differential equations: for example, $$\dot{x}=y,\quad\dot{y}=2x$$ may be solved either by differentiation: $$\ddot{x}=\dot{y}\quad\Rightarrow\quad\ddot{x}=2x$$, or by guessing the solution in the form $$x(t)=C_1e^{\lambda t}$$ , $$y(t)=C_2e^{\lambda t}$$.

Note: Since these equations are linear, you should add all the possible pieces of the general solution with different values of $$\lambda$$.

Exercise:

By guessing the solution in the form $$x(t)=C_1e^{\lambda t},y(t)=C_2e^{\lambda t}$$, find the general solution of the system $$\ddot{x}+x=-y,\quad\ddot{y}+y=3x$$