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

${\frac {dx(t)}{dt}}=4x+8t,\quad x(0)=0$
${\frac {d^{2}x(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^{n}dt={\frac {t^{n+1}}{n+1}};\quad \int e^{x}dx=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.

• $\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=$

Test yourself!!!!!!

• $\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:

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

where $A$  is an arbitrary constant.

• 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}}\sin 2t$  .
• 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{\sqrt {7}})+B\sin(t{\sqrt {7}})$  .
• Find the general solution of ${\ddot {x}}-7x=0$  . Answer: $x(t)=Ae^{t{\sqrt {7}}}+Be^{-t{\sqrt {7}}}$  .
• 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$  .

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

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.

• $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$

Hint: The last two equations have tricky boundary conditions!

### 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 ^{2}x=0$  have the general solution $x(t)=A_{1}\cos(\omega t)+A_{2}\sin(\omega t)$  . What about ${\ddot {x}}+\omega ^{2}x=A+Bt$  ? Write $x(t)=C_{1}+C_{2}t$  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_{1}t+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^{2}x=0$
• ${\dot {x}}+e^{t}x=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^{2}t^{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^{2}t^{2}$  . We write

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

• ${\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_{1}t\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_{1}e^{-t}+C_{2}te^{-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_{1}e^{\lambda t}$  , $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 $\lambda$  .

Exercise:

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

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