Diff Eq

Differential Equations

Almost all laws of Physics are expressed as differential equations, equations that contain derivatives. For example Newton’s second law is \(F=ma\), which means \(F=m \frac{d^2 x}{dt^2}\).

There are many types of differential equations and many books and classes dedicated to their solution. This page will focus on two types we often find in introductory Physics:

“Solving” a differential equation means finding a function that obeys it.

Separation of variablesComplex exponentials


Separation of variables

Separable differential equations can be solved by separating the variables onto opposite sides of the equation, then integrating to remove the derivative.

Kinematics problems (see examples) often follow this pattern. Some function is provided relating \(x\), \(v\), \(a\) or \(t\). This function is then used with the definitions of velocity and acceleration (\(v = \frac{dx}{dt}\) and \(a = \frac{dv}{dt}\)). To solve, we separate the variables and integrate both sides.

Example

An insect travels along a curved path with a speed of \(v = (A - Bx)\) m/s, where \(x\) is the distance along the path in meters, and \(A\) and \(B\) are constants. What is its position as a function of time, \(x(t)\), assuming \(x=0\) at time \(t=0\).

To solve, put the given function into the velocity definition:

\[ v = \frac{dx}{dt} \] \[ \frac{dx}{dt} = A - Bx \]

We now separate variables: put all the \(x\)-dependence on one side and \(t\)-dependence on the other.

\[ \frac{dx}{A - Bx} = dt \]

Now we can integrate both sides.

\[ \int_0^x \frac{dx}{A - Bx} = \int_0^t dt \] \[ \left[ -\frac{1}{B} \ln (A - Bx) \right]_0^x = t - 0\] \[ -\frac{1}{B} \left( \ln (A - Bx) - \ln A \right) = t \]

And solve for \(x\):

\[ \ln \left( \frac{A - Bx}{A} \right) = - Bt \] \[ \frac{A - Bx}{A} = e^{- Bt} \] \[ Bx = A - A e^{- Bt} \] \[ x(t) = \frac{A}{B} \left( 1- e^{- Bt} \right) \]


Complex exponentials

The exponential function is special because it is its own derivative: \(\frac{d}{dx} e^x = e^x\). With Euler’s Formula (\(e^{ix} = \cos x + i \sin x\)), complex exponentials can be used to solve differential equations of the form

\[ y'' + A y' + B y =0. \]

Two important Physics examples are given below. In both cases, you assume the solution has the form of a complex exponential, take derivatives, then plug it into the differential equation.

Simple harmonic motion

When studying the dynamics of a mass \(m\) bouncing on a spring of constant \(k\), the following equation appears:

\[ \ddot{x} + \frac{k}{m} x = 0 \]

where the dot indicates a time-derivative (\(\dot{x} = \frac{dx}{dt}\), \(\ddot{x} = \frac{d^2x}{dt^2}\)).

We want to find an equation for the motion of this mass, \(x(t)\). We start by assuming a solution of the form \(x(t) = Z e^{Wt}\), where \(Z\) and \(W\) are unknown constant complex numbers. Of course position \(x\) must be a real-valued function, so we are really saying \(x(t) = \textup{Re} ( Z e^{Wt} )\) (take the real part only).

Two time derivatives give

\[ \frac{d^2}{dt^2} \left( Z e^{Wt} \right) = ZW^2 e^{Wt} \]

Put this into the differential equation, divide out \(Z e^{Wt}\), then solve for \(W\) to find

\[ ZW^2 e^{Wt} + \frac{k}{m} Z e^{Wt} = 0 \] \[ W^2 = - \frac{k}{m} \] \[ W = i \sqrt{ \frac{k}{m} } = i \omega \]

where we define \(\omega = \sqrt{k/m}\). Finally, write \(Z\) in complex polar form as \(Z = Ae^{i \phi}\). Then the solution is

\[ \begin{aligned} x(t) &= \textup{Re} \left( Ae^{i \phi} e^{i \omega t} \right) \\ &= A \; \textup{Re} \left( e^{i (\omega t + \phi)} \right) \\ &= A \cos (\omega t + \phi) \\ \end{aligned} \]

This is our solution. The motion of a mass on a spring is “harmonic” (a sinusoid).

Damped harmonic motion

For a mass-spring system with some frictional loss, the following equation appears:

\[ m \ddot{x} + b \dot{x} + k x = 0 \]

(Note, this equation also models an RLC circuit – see below.)

As before, assume a solution of the form \(\displaystyle x(t) = Z e^{(B + i D)t}\) where \(B\) and \(D\) have dimensions of 1/time. \(Z\) can be complex, so \(Z = A e^{i \phi}\) where \(A\) has dimensions of distance and \(\phi\) is a dimensionless phase angle.

To find constants \(B\) and \(D\), substitute \(\displaystyle \dot{x} = (B + i D) x\) and \(\displaystyle \ddot{x} = (B + i D)^2 x\) into the differential equation:

\[ m (B + i D)^2 x + b (B + i D) x + k x = 0 \]

Divide out \(x\) and simplify:

\[ m B^2 - m D^2 + b B + k + i( 2 m B D + b D ) = 0 \]

The real part and the imaginary part must each be zero. Assuming \(D \neq 0\), the imaginary part gives

\[ B = - \frac{b}{2m} \]

For convenience later, we define \(\tau = \frac{2m}{b}\), which has dimensions of time. So \(B = -\frac{1}{\tau}\). Substitute this \(B\) into the real part and solve for \(D\):

\[ mB^2 - m D^2 - b B + k = 0 \]

\[ \frac{b^2}{4m} - m D^2 - \frac{b^2}{2m} + k = 0 \]

\[ D^2 = \frac{k}{m} - \frac{b^2}{4m^2} \]

\[ D = \sqrt{ \frac{k}{m} - \left( \frac{b}{2m} \right)^2 } = \sqrt{ \frac{k}{m} - \frac{1}{\tau^2} } \equiv \omega \]

So the solution is

\[ x(t) = A e^{i \phi} e^{-t/\tau} e^{i \omega t} = A e^{-t/\tau} e^{i (\omega t + \phi)} \]

where \(\displaystyle \tau = \frac{2m}{b}\) and \(\displaystyle \omega = \sqrt{ \frac{k}{m} - \frac{1}{\tau^2} }\). Actually we take just the real part: \(x(t) = A e^{-t/\tau} \cos (\omega t + \phi)\).

This is the motion of a damped oscillator. If \(\tau \gt \sqrt{\frac{m}{k}}\) then the mass bounces back and forth as its amplitude exponentially decays with time constant \(\tau\). Can you see what happens if \(\tau \le \sqrt{\frac{m}{k}}\)?

RLC circuits

In Physics 2 we develop the differential equation that models an RLC circuit:

\[ L \ddot{q} + R \dot{q} + \frac{1}{C} q = 0 \]

where \(q\) is the charge on the capacitor. This equation has exactly the same form as the damped oscillator, so we may quote the solution:

\[q(t) = A e^{-t/\tau} \cos (\omega t + \phi)\]

where \(\displaystyle \tau = \frac{2L}{R}\) and \(\displaystyle \omega = \sqrt{ \frac{1}{LC} - \frac{1}{\tau^2} }\).


Last modified: November 02, 2025