Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 25

Solving Constant Coefficient Linear ODEs

Recommended resources

Hello! Welcome to the first lesson in our module on Mathematical Methods for Physics.

In our previous module on Analytical Mechanics, we saw how Hamilton's equations describe a system's trajectory through phase space. We learned to visualize these trajectories by drawing phase portraits, which involved analyzing the "flow" around fixed points. This analysis relied on linearizing the equations of motion—a process that turns complex nonlinear dynamics into simpler linear ones in a small region. Those simplified equations were, in fact, Ordinary Differential Equations (ODEs).

Today, we will build the formal mathematical machinery to solve these equations analytically. This lesson addresses the learning outcome: Solve first-order and second-order linear ordinary differential equations (ODEs) with constant coefficients. Mastering these techniques is not just a mathematical exercise; it's fundamental to describing countless physical systems, from electrical circuits and mechanical oscillators to quantum particles.

1. What are Differential Equations?

A differential equation relates a function to its derivatives. In physics, these equations are ubiquitous because fundamental laws often connect a quantity's rate of change to the quantity itself. Newton's second law, , is a prime example, as acceleration is the second derivative of position, .

This lesson focuses on a specific, but very important, class of these equations: linear ODEs with constant coefficients.

  • Ordinary (ODE): The function depends on only one independent variable (e.g., time ).
  • Linear: The unknown function and its derivatives appear only to the first power.
  • Constant Coefficients: The numbers multiplying the function and its derivatives are constants, not functions of the independent variable.

To get a feel for the terminology and why these equations are so crucial in physics, let's start with a short introductory video.

Differential Equations. All Basics for Physicists.

This video, from the channel of Alexander (gottespfad.de), provides an excellent overview of what differential equations are and how we classify them. It uses the simple harmonic oscillator as a core example, which should be familiar to you.

Watch the first 15 minutes and 41 seconds of the video. Focus on understanding the classification of differential equations (ordinary vs. partial, order, linearity, homogeneity). Don't worry about memorizing every detail; the goal is to get a conceptual map of the landscape.


2. First-Order Linear ODEs

The simplest case is the first-order linear ODE with constant coefficients, which has the general form:

Here, is a constant, and is a function of time, often called the forcing term or source term.

2.1 The Homogeneous Equation

If the forcing term is zero (), the equation is called homogeneous:

You can solve this using a method called separation of variables. Rearranging the equation gives:

Integrating both sides gives , where is the integration constant. Exponentiating both sides yields the general solution:

where is an arbitrary constant determined by the initial condition of the system. This exponential decay (or growth, if ) is characteristic of many physical processes, like radioactive decay or the discharging of a capacitor.

2.2 The Inhomogeneous Equation: Integrating Factor Method

When is not zero, we need a more powerful technique. The standard method is to use an integrating factor. The goal is to multiply the entire equation by a function that makes the left-hand side the result of a single product rule differentiation.

Differential Equations for Engineers

The following text, 'Differential Equations for Engineers' from the HKUST Math Department, provides a rigorous derivation of the integrating factor method.

Please read 'Lecture 5 | Linear first-order equations' (pages 12-13). Follow the derivation of the integrating factor μ(x) in equation (5.4) and see how it leads to the general solution in equation (5.3).

As the text shows, for our equation , the integrating factor is . Multiplying the ODE by gives:

The left side is now, by design, the derivative of a product:

Integrating both sides with respect to time from an initial time to gives:

Solving for yields the general solution.

Application: The RC Circuit
A classic engineering application is the charging of a capacitor in a simple RC circuit. The differential equation for the voltage across the capacitor, , is:

where is the battery voltage. This is a first-order linear ODE with and a constant forcing term . Applying the integrating factor method gives the solution for the charging capacitor, as detailed in Lecture 9 of the Differential Equations for Engineers notes.


3. Second-Order Homogeneous Linear ODEs

Now we move to second-order equations, which are central to mechanics. The general form with constant coefficients is:

We'll start with the homogeneous case, where .

The Exponential Ansatz and the Characteristic Equation

Inspired by the solution to the first-order equation, we make an educated guess, or ansatz, of the form . Substituting this into the homogeneous ODE gives:

Since is never zero, we can divide it out, leaving a simple quadratic equation for :

This is called the characteristic equation. Its roots determine the solution to the ODE. The quadratic formula gives two roots, and . The general solution is then a linear combination (superposition) of the solutions corresponding to each root: .

The nature of the roots leads to three distinct physical behaviors.

Differential Equations for Engineers

The following lectures from 'Differential Equations for Engineers' systematically cover the solution for all three cases of the characteristic equation's roots. This is the core method for homogeneous second-order ODEs.

Please read Lectures 13 through 18 (pages 32-41). This will guide you through: Lecture 13: The setup of the characteristic equation. Lectures 14-16: The cases of distinct real roots and complex-conjugate roots, with examples. Pay close attention to the use of Euler's formula in the complex case. Lectures 17-18: The case of repeated real roots, including the justification for the second solution of the form t * e^(rt).

Let's summarize the three cases, which you've just read about, in the context of a mechanical oscillator (e.g., a mass on a spring with damping):

  • Case 1: Distinct Real Roots ()
    The solution is . Since are positive for a damped oscillator, the roots will be negative. This describes an overdamped system. If displaced, it returns to equilibrium slowly without oscillating.

  • Case 2: Complex Conjugate Roots ()
    The roots are of the form . Using Euler's formula (), the real-valued general solution becomes . This describes an underdamped system. The system oscillates with frequency , but the amplitude of oscillations decays exponentially according to . This is the mathematical description of most real-world oscillators.

  • Case 3: Repeated Real Roots ()
    The roots are identical, . The two independent solutions are and , giving the general solution . This is the special case of critical damping, which provides the fastest possible return to equilibrium without any oscillation. It's a crucial concept in designing systems like car suspensions or swinging doors.

Test your understanding!

The equation for a simple harmonic oscillator is . What are the roots of its characteristic equation? What type of motion does this correspond to in the classification above?

Show answer

The characteristic equation is . The roots are . These are pure imaginary complex conjugate roots (Case 2, with ). The solution is . This corresponds to undamped, simple harmonic motion, where the oscillation continues forever with constant amplitude.


4. Second-Order Inhomogeneous Linear ODEs

Finally, let's consider the case where the system is driven by an external force, .

The cornerstone for solving these is the principle of superposition. The general solution is the sum of two parts:

  1. The homogeneous solution , which we just learned how to find. It describes the system's natural "transient" behavior.
  2. A particular solution , which is any single solution that satisfies the full inhomogeneous equation. It describes the system's long-term "steady-state" response to the driving force.

The constants and are determined by the initial conditions after the full solution is constructed.

The Method of Undetermined Coefficients

For many common forcing functions ( being a polynomial, exponential, sine, or cosine), we can find by guessing a particular solution of the same form as the forcing function, but with unknown coefficients. We then substitute this guess into the ODE and solve for the coefficients.

Differential Equations for Engineers

These lectures from 'Differential Equations for Engineers' explain the general strategy and provide a guide for choosing the correct ansatz for different forcing functions.

Read 'Lecture 19 | Inhomogeneous second-order ode' to understand the general method. Then, quickly review Lectures 20, 21, and 23 (pages 47-53) to see the specific guesses for exponential, sine/cosine, and polynomial forcing terms. Don't worry about the complex method in Lecture 22 for now; focus on the main idea of guessing a solution of a similar form.

Example: Driven Oscillator
Consider a damped oscillator driven by a sinusoidal force: .

  1. Find : Solve the homogeneous equation using the characteristic equation method. This gives the transient damped oscillations.
  2. Find : The forcing term is . We guess a particular solution of the form . We need the sine term because the derivative of cosine is sine.
  3. Solve for Coefficients: Substitute into the full ODE. Group the and terms and equate their coefficients on both sides of the equation to solve for and . This gives you the steady-state oscillation amplitude and phase.

This method forms the basis for analyzing resonance, a key topic you will encounter in Module 2.


Conclusion

In this lesson, you have been equipped with a powerful toolkit to solve a wide range of problems in classical mechanics and other areas of physics.

Key Takeaways:

  • First-order linear ODEs () are solved using an integrating factor, typically .
  • Second-order homogeneous linear ODEs with constant coefficients () are solved by finding the roots of the characteristic equation . The nature of the roots (real distinct, complex conjugate, or real repeated) dictates whether the system is overdamped, underdamped, or critically damped.
  • Second-order inhomogeneous linear ODEs () are solved by finding the general solution to the homogeneous part () and adding a particular solution (). For common forcing functions, can be found using the method of undetermined coefficients.

Preview of the Next Lesson:
The method of undetermined coefficients works well for simple forcing functions like . But what if the driving force is a more complex periodic function, like a square wave or a sawtooth wave? To handle such cases, we need a way to represent any periodic function as a sum of sines and cosines. This is precisely what a Fourier series does. In our next lesson, we will learn how to represent periodic functions using Fourier series and calculate their coefficients, opening the door to solving ODEs with much more complex, realistic driving forces.