# Classical Mechanics/Differential Equations

## 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:

${\displaystyle {\frac {dx(t)}{dt}}=4x+8t,\quad x(0)=0}$
${\displaystyle {\frac {d^{2}x(t)}{dt^{2}}}+15x(t)=10,\quad x(0)=1,\quad {\dot {x}}(0)=0}$
${\displaystyle {\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: ${\displaystyle \int \limits _{a}^{b}f(x)dx}$ . (There is really no separate concept of an "indefinite integral." The notation ${\displaystyle \int f(x)dx}$ is merely the shorthand for ${\displaystyle \int \limits _{x_{0}}^{x}f(x')dx'}$ , where ${\displaystyle x_{0}}$ is not used in later calculations and/or is chosen for convenience in some natural way.)

Some basic integrals:

${\displaystyle \int f(ax)dx={\frac {1}{a}}\int f(x)dx;\quad \int t^{n}dt={\frac {t^{n+1}}{n+1}};\quad \int e^{x}dx=e^{x};\quad \int \cos(x)dx=\sin(x)}$${\displaystyle \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 ${\displaystyle x=g(z)}$ , where ${\displaystyle g(z)}$ is a function:

${\displaystyle \int f(x)dx=\int f(g(z)){\frac {dg(z)}{dz}}dz}$

Examples:

${\displaystyle \int {\frac {dx}{1+x}}=\ln(1+x)}$${\displaystyle \int {\frac {dx}{x^{2}}}\sin \left({\tfrac {1}{x}}\right)=\cos \left({\tfrac {1}{x}}\right)}$

Integration by parts:

${\displaystyle \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):

${\displaystyle \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):

${\displaystyle \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.

• ${\displaystyle \int e^{2x}\sin(x)dx=}$
• ${\displaystyle \int t^{2}\sin(t)dt=}$
• ${\displaystyle \int \sin ^{2}(x)dx=}$
• ${\displaystyle \int {\frac {dx}{\sqrt {2x+1}}}=}$
• ${\displaystyle \int x{\sqrt {3x+1}}dx=}$

Test yourself!!!!!!

• ${\displaystyle \int {\sqrt {\tan(x)}}dx=}$

## General solutions and particular solutions

In this section, differential equations are written for unknown function ${\displaystyle x(t)}$ . Derivatives are denoted by overdots: ${\displaystyle {\dot {x}}\equiv {\frac {dx}{dt}}}$ , ${\displaystyle {\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:

• Find the general solution of the equation ${\displaystyle {\dot {x}}(t)=0}$ . Answer: ${\displaystyle x(t)=A}$ ,

where ${\displaystyle A}$ is an arbitrary constant.

• Find the general solution of ${\displaystyle {\dot {x}}=2}$ . Answer: ${\displaystyle x(t)=A+2t}$ .
• Find the general solution of ${\displaystyle {\dot {x}}=4t+\cos(2t)}$ . Answer: ${\displaystyle x(t)=A+2t^{2}+{\frac {1}{2}}\sin 2t}$ .
• Find the general solution of ${\displaystyle {\dot {x}}+x=0}$ . Answer: ${\displaystyle x(t)=Ae^{-t}}$ .
• Find the general solution of the second-order equation ${\displaystyle {\ddot {x}}=0}$ . Answer: ${\displaystyle x(t)=A+Bt}$ .
• Find the general solution of ${\displaystyle {\ddot {x}}+7x=0}$ . Answer: ${\displaystyle x(t)=A\cos(t{\sqrt {7}})+B\sin(t{\sqrt {7}})}$ .
• Find the general solution of ${\displaystyle {\ddot {x}}-7x=0}$ . Answer: ${\displaystyle x(t)=Ae^{t{\sqrt {7}}}+Be^{-t{\sqrt {7}}}}$ .
• Find the general solution of ${\displaystyle {\ddot {x}}+5{\dot {x}}+4x=0}$ . Solution: we look for ${\displaystyle x(t)=Ae^{\lambda t}}$ . Then ${\displaystyle \lambda }$ must be such that ${\displaystyle \lambda ^{2}+5\lambda +4=0}$ .

This has two solutions, ${\displaystyle \lambda =-1}$ and ${\displaystyle \lambda =-4}$ . So the general solution is ${\displaystyle x(t)=Ae^{-t}+Be^{-4t}}$.

Exercises:

Find the general solution of the following equations.

• ${\displaystyle {\dot {x}}=2x}$
• ${\displaystyle {\ddot {x}}=3t+e^{-t}}$
• ${\displaystyle {\ddot {x}}={\dot {x}}}$
• ${\displaystyle {\ddot {x}}=-10x}$
• ${\displaystyle {\ddot {x}}=-2006{\dot {x}}+2006x}$

Particular solutions are selected from general solutions by conditions, such as the initial conditions:

${\displaystyle {\ddot {x}}=1,\quad x(0)=1,\quad {\dot {x}}(0)=2.\quad (1)}$

The general solution of ${\displaystyle {\ddot {x}}=1}$ is ${\displaystyle x(t)=A+Bt+{\frac {t^{2}}{2}}}$ . The conditions ${\displaystyle x(0)=1}$ , ${\displaystyle {\dot {x}}(0)=2}$ are satisfied only if ${\displaystyle A=1}$ , ${\displaystyle B=2}$ . Therefore, the particular solution of equation (1) is ${\displaystyle 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 ${\displaystyle x(t)}$ .

• ${\displaystyle {\dot {x}}+3x=0,\quad x(0)=2}$
• ${\displaystyle {\dot {x}}-x=0,\quad x(2)=1}$
• ${\displaystyle {\ddot {x}}-4x=0,\quad x(0)=1,\quad {\dot {x}}(0)=1}$
• ${\displaystyle {\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 ${\displaystyle x(0)={\dot {x}}(0)=0}$ , one can specify two conditions at different times, e.g. ${\displaystyle x(0)=1,x(1)=2}$ . Such conditions are called boundary conditions.

Exercises:

Solve the following boundary-value problems.

• ${\displaystyle 3{\ddot {x}}+4x=0,\quad x(0)=0,\quad x(2)=5}$
• ${\displaystyle {\ddot {x}}=4e^{-t},\quad x(0)=1,\quad x(1)=0}$
• ${\displaystyle {\ddot {x}}+4x=0,\quad x(0)=0,\quad x(\pi )=\pi }$
• ${\displaystyle {\ddot {x}}+x=0,\quad x(0)=2\pi ,\quad x(2\pi )=2\pi }$

Hint: The last two equations have tricky boundary conditions!

### Some simple inhomogeneous equations

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

Exercises:

Solve the following equations.

• ${\displaystyle {\dot {x}}+3x=2,\quad x(0)=1}$
• ${\displaystyle {\ddot {x}}+5{\dot {x}}+4x=8,\quad x(0)=2,\quad {\dot {x}}(0)=0}$
• ${\displaystyle 2{\ddot {x}}+18x=-1,\quad x(1)=1,\quad {\dot {x}}(1)=0}$
• ${\displaystyle {\ddot {x}}+9{\dot {x}}=-2,\quad x(0)=0,\quad {\dot {x}}(0)=3}$

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

Similarly, ${\displaystyle {\ddot {x}}+\omega ^{2}x=0}$ have the general solution ${\displaystyle x(t)=A_{1}\cos(\omega t)+A_{2}\sin(\omega t)}$ . What about ${\displaystyle {\ddot {x}}+\omega ^{2}x=A+Bt}$ ? Write ${\displaystyle x(t)=C_{1}+C_{2}t}$ and find the correct values of ${\displaystyle C_{1}}$ and ${\displaystyle C_{2}}$ , then add the general solution. The result is ${\displaystyle 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:

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

## Method of "variation of constants"

What about ${\displaystyle {\dot {x}}=Bx+f(t)}$ , where ${\displaystyle f(t)}$ is some more complicated function? These are solved with the method of variation of constants. The solution is found as ${\displaystyle x(t)=A(t)e^{Bt}}$, where ${\displaystyle A(t)}$ is an unknown function. Substituting into ${\displaystyle {\dot {x}}=Bx+f(t)}$ , we have

${\displaystyle {\dot {A}}e^{Bt}+BAe^{Bt}=BAe^{Bt}+f(t)}$

therefore the function ${\displaystyle A(t)}$ satisfies the equation ${\displaystyle {\dot {A}}=e^{-Bt}f(t)}$ . Its general solution is

${\displaystyle A(t)=\int \limits _{t_{0}}^{t}e^{-Bt_{1}}f(t_{1})dt_{1}}$

where ${\displaystyle t_{0}}$ is an arbitrary constant. Therefore, the general solution for ${\displaystyle x(t)}$ is

${\displaystyle x(t)=e^{Bt}\int \limits _{t_{0}}^{t}e^{-Bt_{1}}f(t_{1})dt_{1}}$

This can be also rewritten as

${\displaystyle 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 ${\displaystyle A}$ is an arbitrary constant.

Example:

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

Exercises:

Solve the following equations with initial or boundary conditions.

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

More general equations:

${\displaystyle {\dot {x}}-f(t)x=0\quad \Rightarrow \quad x=Ae^{\int f(t)dt}}$

For example: ${\displaystyle {\dot {x}}+2tx=0}$ has the general solution ${\displaystyle x(t)=Ae^{-t^{2}}}$ .

Exercises:

Find the general solution of the following equations.

• ${\displaystyle {\dot {x}}+t^{2}x=0}$
• ${\displaystyle {\dot {x}}+e^{t}x=e^{t}}$

Another general formula is

${\displaystyle {\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 ${\displaystyle Ae^{\int f(t)dt}}$ .

## Method of "separation of variables"

Another useful method applies to differential equations of the form

${\displaystyle {\dot {x}}=f(x)g(t)}$

For example, the differential equations ${\displaystyle {\dot {x}}=x^{2}t^{2}}$ and ${\displaystyle {\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 ${\displaystyle F(x)=G(t)}$, where ${\displaystyle F}$ and ${\displaystyle G}$ are some functions. If the solution were in this form, then ${\displaystyle {\frac {d}{dt}}F(x)={\frac {d}{dt}}G(t)}$ , which is the same as ${\displaystyle (dF/dx){\dot {x}}=dG/dt}$ . This should be equivalent to the original differential equation ${\displaystyle {\dot {x}}=f(x)g(t)}$ . Therefore,

${\displaystyle {\frac {dF(x)}{dx}}={\frac {1}{f(x)}},\quad {\frac {dG(t)}{dt}}=g(t)}$

These equations are easy to solve:

${\displaystyle 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:

${\displaystyle \int \limits _{x_{0}}^{x}{\frac {dx}{f(x)}}=\int \limits _{t_{0}}^{t}g(t)dt}$

Here, ${\displaystyle x_{0}}$ and ${\displaystyle t_{0}}$ are arbitrary constants of integration. This solution satisfies the initial condition ${\displaystyle x(t_{0})=x_{0}}$ .

Example:

Consider the equation ${\displaystyle {\dot {x}}=x^{2}t^{2}}$ . We write

${\displaystyle {\frac {\dot {x}}{x^{2}}}=t^{2}\quad \Rightarrow \quad \int {\frac {dx}{x^{2}}}=\int t^{2}dt\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.

• ${\displaystyle {\dot {x}}={\frac {x}{t}}}$
• ${\displaystyle {\frac {dy(x)}{dx}}={\frac {1+y}{1+x}}}$
• ${\displaystyle {\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:

${\displaystyle {\ddot {x}}+x=\cos(2t)\Rightarrow x(t)=C_{1}\cos(2t),\quad {\textrm {then~find~}}C_{1}}$

${\displaystyle {\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}}$

${\displaystyle {\ddot {x}}+x=\sin(t)\Rightarrow x(t)=C_{1}t\cos(t),\quad {\textrm {then~find~}}C_{1}}$

Note: in the last example, we need a term ${\displaystyle t\cos t}$ because ${\displaystyle \sin(t)}$ and ${\displaystyle \cos(t)}$ are already solutions of the homogeneous equation!

Another example:

${\displaystyle {\ddot {x}}+2{\dot {x}}+x=0}$

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

Exercises:

Solve the following equations.

• ${\displaystyle {\ddot {x}}+4x=\sin(t)+1,\quad x(0)={\dot {x}}(0)=1}$
• ${\displaystyle {\ddot {x}}+4x=\sin(2t)+1,\quad x(0)={\dot {x}}(0)=1}$
• ${\displaystyle {\ddot {x}}-4{\dot {x}}+4x=2,\quad x(0)={\dot {x}}(0)=1}$

Systems of differential equations: for example,

${\displaystyle {\dot {x}}=y,\quad {\dot {y}}=2x}$

may be solved either by differentiation: ${\displaystyle {\ddot {x}}={\dot {y}}\quad \Rightarrow \quad {\ddot {x}}=2x}$ , or by guessing the solution in the form ${\displaystyle x(t)=C_{1}e^{\lambda t}}$ , ${\displaystyle y(t)=C_{2}e^{\lambda t}}$ .

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

Exercise:

By guessing the solution in the form ${\displaystyle x(t)=C_{1}e^{\lambda t},y(t)=C_{2}e^{\lambda t}}$ , find the general solution of the system

${\displaystyle {\ddot {x}}+x=-y,\quad {\ddot {y}}+y=3x}$