Linear Algebra & DE · Unit 2 · Topic 08

Linear and Bernoulli equations: one factor turns the left side into a derivative.

Short answer

For \(\dfrac{dy}{dx} + Py = Q\), multiply by the integrating factor \(\text{IF} = e^{\int P\,dx}\). Then \(y\cdot\text{IF} = \int Q\cdot\text{IF}\,dx + c\).

Bernoulli's equation \(y' + Py = Qy^n\) becomes linear with \(z = y^{1-n}\).

Example: \(y' + 2y = e^{-x}\) has IF \(e^{2x}\) and solution \(y = e^{-x} + c\,e^{-2x}\).

Engineering MathsB Tech / BEBSc
01

Linear equations and the integrating factor

Before you start: you should be comfortable with integration by parts and with the product rule. The idea of an integrating factor comes from exact equations.

A first-order equation is linear in \(y\) if \(y\) and \(\dfrac{dy}{dx}\) appear only to the first power and are never multiplied together. Every such equation can be written in the standard form below, where \(P\) and \(Q\) are functions of \(x\) only.

Linear equation

\[\frac{dy}{dx} + P\,y = Q, \qquad \text{IF} = e^{\int P\,dx}\]

Solution: \[y\cdot \text{IF} = \int Q\cdot\text{IF}\,dx + c\]

Linear in \(x\)

If the equation is \(\dfrac{dx}{dy} + P\,x = Q\) with \(P, Q\) functions of \(y\), then IF \(= e^{\int P\,dy}\) and \(x\cdot\text{IF} = \int Q\cdot\text{IF}\,dy + c\).

Why it works: with \(\mu = e^{\int P\,dx}\) we have \(\mu' = P\mu\). So by the product rule \[\frac{d}{dx}(\mu y) = \mu y' + P\mu y = \mu\,(y' + Py) = \mu Q.\] The left side of the equation, once multiplied by \(\mu\), is an exact derivative. Integrate both sides and you are done.

02

Bernoulli's equation

Bernoulli's equation

\[\frac{dy}{dx} + P\,y = Q\,y^n \qquad (n \ne 0, 1)\]

Divide by \(y^n\) and put \(z = y^{1-n}\). The equation becomes linear in \(z\): \[\frac{dz}{dx} + (1 - n)P\,z = (1 - n)Q\]

The substitution works because \(\dfrac{dz}{dx} = (1 - n)\,y^{-n}\dfrac{dy}{dx}\), and after dividing by \(y^n\) the equation reads \(y^{-n}y' + P\,y^{1-n} = Q\). Both pieces are now in terms of \(z\).

The same trick works for equations like \(f'(y)\dfrac{dy}{dx} + P\,f(y) = Q\): put \(z = f(y)\) and the equation is linear in \(z\). Example 8 uses \(z = \tan y\).

  1. Divide by the coefficient of \(\dfrac{dy}{dx}\) to reach standard form. Read off \(P\) and \(Q\).
  2. If there is a \(y^n\) on the right, divide by it and substitute \(z = y^{1-n}\).
  3. Find the IF \(e^{\int P\,dx}\) and simplify it (\(e^{\log f} = f\)).
  4. Write \(y\cdot\text{IF} = \int Q\cdot\text{IF}\,dx + c\), with the constant added before you divide.
  5. Use the initial condition, if one is given, to find \(c\).
03

Solved examples

Example 1: Constant coefficient

Easy

Solve \(\dfrac{dy}{dx} + 2y = e^{-x}\).

  1. \(P = 2\), so IF \(= e^{2x}\).
  2. \(y\,e^{2x} = \int e^{-x}e^{2x}\,dx = \int e^{x}\,dx = e^x + c\).
  3. Divide by \(e^{2x}\).

Answer\(y = e^{-x} + c\,e^{-2x}\)

Example 2: Divide first

Easy

Solve \(x\dfrac{dy}{dx} + 2y = x^2\) for \(x > 0\).

  1. Standard form: \(\dfrac{dy}{dx} + \dfrac{2}{x}y = x\). So \(P = \dfrac{2}{x}\), \(Q = x\).
  2. IF \(= e^{2\log x} = x^2\).
  3. \(y\,x^2 = \int x^3\,dx = \dfrac{x^4}{4} + c\).

Answer\(y = \dfrac{x^2}{4} + \dfrac{c}{x^2}\)

Example 3: A trigonometric P

Medium

Solve \(\dfrac{dy}{dx} + y\tan x = \sec x\) on \(-\dfrac{\pi}{2} < x < \dfrac{\pi}{2}\).

  1. IF \(= e^{\int\tan x\,dx} = e^{\log\sec x} = \sec x\).
  2. \(y\sec x = \int \sec^2 x\,dx = \tan x + c\).
  3. Multiply by \(\cos x\).

Answer\(y = \sin x + c\cos x\)

Example 4: An initial value problem

Medium

Solve \(\dfrac{dy}{dx} + 2xy = 2x\), given \(y(0) = 3\).

  1. IF \(= e^{\int 2x\,dx} = e^{x^2}\).
  2. \(y\,e^{x^2} = \int 2x\,e^{x^2}\,dx = e^{x^2} + c\), so \(y = 1 + c\,e^{-x^2}\).
  3. \(y(0) = 1 + c = 3\) gives \(c = 2\).

Answer\(y = 1 + 2e^{-x^2}\)

Example 5: Linear in x

Medium

Solve \((1 + y^2)\,dx = (\tan^{-1}y - x)\,dy\).

  1. This is not linear in \(y\), but it is linear in \(x\): \(\dfrac{dx}{dy} + \dfrac{x}{1 + y^2} = \dfrac{\tan^{-1}y}{1 + y^2}\).
  2. IF \(= e^{\int dy/(1 + y^2)} = e^{\tan^{-1}y}\).
  3. \(x\,e^{\tan^{-1}y} = \displaystyle\int \frac{\tan^{-1}y\;e^{\tan^{-1}y}}{1 + y^2}\,dy\). Put \(t = \tan^{-1}y\): \(\int t\,e^t\,dt = (t - 1)e^t\).
  4. So \(x\,e^{\tan^{-1}y} = (\tan^{-1}y - 1)\,e^{\tan^{-1}y} + c\).

Answer\(x = \tan^{-1}y - 1 + c\,e^{-\tan^{-1}y}\)

Example 6: Bernoulli with n = 6

Medium

Solve \(\dfrac{dy}{dx} + \dfrac{y}{x} = x^2y^6\).

  1. Divide by \(y^6\): \(y^{-6}\dfrac{dy}{dx} + \dfrac{1}{x}y^{-5} = x^2\). Put \(z = y^{-5}\), so \(\dfrac{dz}{dx} = -5y^{-6}\dfrac{dy}{dx}\).
  2. Then \(-\dfrac{1}{5}\dfrac{dz}{dx} + \dfrac{z}{x} = x^2\), that is \(\dfrac{dz}{dx} - \dfrac{5}{x}z = -5x^2\).
  3. IF \(= e^{-5\log x} = x^{-5}\). \(z\,x^{-5} = \int -5x^{-3}\,dx = \dfrac{5}{2}x^{-2} + c\).
  4. So \(z = \dfrac{5}{2}x^3 + c\,x^5\).

Answer\(\dfrac{1}{y^5} = \dfrac{5x^3}{2} + c\,x^5\)

Example 7: Bernoulli with an initial condition

Exam level

Solve \(\dfrac{dy}{dx} + y = x\,y^3\), given \(y(0) = 1\).

  1. Divide by \(y^3\) and put \(z = y^{-2}\), \(\dfrac{dz}{dx} = -2y^{-3}\dfrac{dy}{dx}\). The equation becomes \(\dfrac{dz}{dx} - 2z = -2x\).
  2. IF \(= e^{-2x}\). \(z\,e^{-2x} = \int -2x\,e^{-2x}\,dx = x\,e^{-2x} + \tfrac{1}{2}e^{-2x} + c\) (by parts).
  3. So \(z = x + \tfrac{1}{2} + c\,e^{2x}\). At \(x = 0\): \(z = 1\), so \(c = \tfrac{1}{2}\).

Answer\(\dfrac{1}{y^2} = x + \dfrac{1}{2} + \dfrac{1}{2}e^{2x}\)

Example 8: A disguised Bernoulli

Exam level

Solve \(\dfrac{dy}{dx} + x\sin 2y = x^3\cos^2 y\).

  1. Divide by \(\cos^2 y\) and use \(\sin 2y = 2\sin y\cos y\): \(\sec^2 y\,\dfrac{dy}{dx} + 2x\tan y = x^3\).
  2. Put \(z = \tan y\), so \(\dfrac{dz}{dx} = \sec^2 y\,\dfrac{dy}{dx}\). Then \(\dfrac{dz}{dx} + 2xz = x^3\).
  3. IF \(= e^{x^2}\). \(z\,e^{x^2} = \int x^3e^{x^2}\,dx\). With \(t = x^2\) this is \(\tfrac{1}{2}\int t\,e^t\,dt = \tfrac{1}{2}(x^2 - 1)e^{x^2}\).

Answer\(\tan y = \dfrac{x^2 - 1}{2} + c\,e^{-x^2}\)

Vipul Sir's tip

The IF is rarely where the answer goes wrong. The last line is. Write \(+\,c\) the moment you integrate, then divide everything by the IF. In Example 2 that gives \(\dfrac{c}{x^2}\), not \(c\). The constant gets divided too.

04

Common mistakes

1. Reading off \(P\) before dividing

For \(x\,y' + 2y = x^2\), taking \(P = 2\) gives IF \(e^{2x}\), which is wrong. Divide by \(x\) first: \(P = \dfrac{2}{x}\) and IF \(= x^2\).

2. Adding the constant after dividing

From \(y\,x^2 = \dfrac{x^4}{4} + c\), the answer is \(y = \dfrac{x^2}{4} + \dfrac{c}{x^2}\). Writing \(y = \dfrac{x^2}{4} + c\) gives a function that does not satisfy the equation.

3. Dropping the factor \((1 - n)\) in Bernoulli

With \(z = y^{1-n}\) both \(P\) and \(Q\) get multiplied by \((1 - n)\). In Example 6 (\(n = 6\)) the linear equation is \(z' - \dfrac{5}{x}z = -5x^2\), not \(z' + \dfrac{1}{x}z = x^2\).

05

Practice questions

Try each one on paper before you open the answer.

Q1Solve \(\dfrac{dy}{dx} + 3y = 6\).

IF \(= e^{3x}\), \(y\,e^{3x} = 2e^{3x} + c\).

\(y = 2 + c\,e^{-3x}\).

Q2Solve \(\dfrac{dy}{dx} + y\cot x = 2\cos x\) on \(0 < x < \pi\).

IF \(= \sin x\). \(y\sin x = \int 2\sin x\cos x\,dx = \sin^2 x + c\).

\(y = \sin x + c\operatorname{cosec}x\).

Q3Solve \((x + 1)\dfrac{dy}{dx} - y = e^x(x + 1)^2\), given \(y(0) = 2\).

Standard form: \(y' - \dfrac{y}{x + 1} = e^x(x + 1)\). IF \(= \dfrac{1}{x + 1}\), so \(\dfrac{y}{x + 1} = e^x + c\).

\(y(0) = 1 + c = 2\), so \(c = 1\): \(y = (x + 1)(e^x + 1)\).

Q4Solve \(y\,dx - (x + 2y^3)\,dy = 0\).

Linear in \(x\): \(\dfrac{dx}{dy} - \dfrac{x}{y} = 2y^2\). IF \(= \dfrac{1}{y}\), so \(\dfrac{x}{y} = y^2 + c\).

\(x = y^3 + c\,y\).

Q5Solve \(\dfrac{dy}{dx} + y = y^2e^x\).

\(z = y^{-1}\) gives \(z' - z = -e^x\). IF \(= e^{-x}\), \(z\,e^{-x} = -x + c\).

\(\dfrac{1}{y} = (c - x)\,e^x\).

Q6Solve \(\dfrac{dy}{dx} + \dfrac{y}{x} = x\,y^2\).

\(z = y^{-1}\) gives \(z' - \dfrac{z}{x} = -x\). IF \(= \dfrac{1}{x}\), \(\dfrac{z}{x} = -x + c\).

\(\dfrac{1}{y} = c\,x - x^2\).

Stuck on a question?

Bring it to a free demo class and work through it with Vipul Sir. Book on WhatsApp.

06

Frequently asked questions

What is a linear differential equation of first order?

One that can be written as \(\dfrac{dy}{dx} + Py = Q\), with \(P\) and \(Q\) functions of \(x\) only. \(y\) and \(\dfrac{dy}{dx}\) appear to the first power and are not multiplied together.

What is the integrating factor of dy/dx + Py = Q?

\(e^{\int P\,dx}\). Multiply the equation by it and the left side becomes \(\dfrac{d}{dx}(y\cdot\text{IF})\).

How do you solve Bernoulli's equation?

Divide \(y' + Py = Qy^n\) by \(y^n\) and put \(z = y^{1-n}\). You get \(z' + (1 - n)Pz = (1 - n)Q\), which is linear in \(z\).

What if the equation is not linear in y?

Check whether it is linear in \(x\), with \(\dfrac{dx}{dy}\) in place of \(\dfrac{dy}{dx}\). If so, use IF \(= e^{\int P\,dy}\). If not, try a substitution as in Bernoulli's equation, or test for exactness.

Related lessons

← All 12 Linear Algebra & DE topics
Vipul Sir
Written by Vipul Sir

Vipul Sir has taught mathematics for over 15 years to HSC, CBSE, ICSE, IGCSE/IB, Diploma, Engineering and BSc students at VVS Classes in Goregaon and Vile Parle, Mumbai. He teaches every class himself, concepts first and exam technique second.

Linear Algebra and Differential Equations

Get Linear Algebra & DE right, with Vipul Sir beside you.

Concept-first classes in small batches in Goregaon and Vile Parle, or online. Your first class is free.

WhatsApp↗