Solving First-Order Linear Differential Equations
Exercises 2.3: Linear Equations
The following problems involve finding the integrating factor, solving the differential equation, and identifying the transient term, where applicable, for first-order linear ordinary differential equations (ODEs) of the form $y’ + P(x)y = Q(x)$ or similar forms.
Equation: $y’ – 0y = 0$
The integrating factor is $e^{\int 0 dx} = e^{0x} = 1$.
The equation becomes $\frac{d}{dx}[1 \cdot y] = 0$.
Solution: $y = c$. The domain is $-\infty < x < \infty$. There is no transient term.
Equation: $y’ + 2y = 0$
The integrating factor is $e^{\int 2 dx} = e^{2x}$.
The equation becomes $\frac{d}{dx}[e^{2x} y] = 0$.
Solution: $e^{2x} y = c$, so $y = ce^{-2x}$. The domain is $-\infty < x < \infty$. The transient term is $ce^{-2x}$.
Equation: $y’ + y = e^{ix}$
The integrating factor is $e^{\int 1 dx} = e^x$.
The equation becomes $\frac{d}{dx}[e^x y] = e^x e^{ix} = e^{(1+i)x}$.
Solution: $e^x y = \int e^{(1+i)x} dx = \frac{1}{1+i} e^{(1+i)x} + c$.
Since $\frac{1}{1+i} = \frac{1-i}{2} = \frac{1}{2} – \frac{i}{2}$,
$y = \left(\frac{1}{2} – \frac{i}{2}\right) e^{ix} + ce^{-x}$. The domain is $-\infty < x < \infty$. The transient term is $ce^{-x}$.
Equation: $y’ + 4y = 4$
The integrating factor is $e^{\int 4 dx} = e^{4x}$.
The equation becomes $\frac{d}{dx}[e^{4x} y] = 4e^{4x}$.
Solution: $e^{4x} y = \int 4e^{4x} dx = e^{4x} + c$, so $y = 1 + ce^{-4x}$. The domain is $-\infty < x < \infty$. The transient term is $ce^{-4x}$.
Equation: $y’ + 3x^2 y = x^2$
The integrating factor is $e^{\int 3x^2 dx} = e^{x^3}$.
The equation becomes $\frac{d}{dx}[e^{x^3} y] = x^2 e^{x^3}$.
Solution: $e^{x^3} y = \int x^2 e^{x^3} dx = \frac{1}{3} e^{x^3} + c$, so $y = \frac{1}{3} + ce^{-x^3}$. The domain is $-\infty < x < \infty$. The transient term is $ce^{-x^3}$.
Equation: $y’ + 2xy = x^3$
The integrating factor is $e^{\int 2x dx} = e^{x^2}$.
The equation becomes $\frac{d}{dx}[e^{x^2} y] = x^3 e^{x^2}$.
Solution: $e^{x^2} y = \int x^3 e^{x^2} dx = \frac{1}{2} x^2 e^{x^2} – \frac{1}{2} e^{x^2} + c$, so $y = \frac{1}{2} x^2 – \frac{1}{2} + ce^{-x^2}$. The domain is $-\infty < x < \infty$. The transient term is $ce^{-x^2}$.
Equation: $y’ + \frac{1}{x} y = -\frac{1}{x^2}$
The integrating factor is $e^{\int (1/x) dx} = e^{\ln|x|} = |x|$. We use $x$ for $x > 0$.
The equation becomes $\frac{d}{dx}[xy] = -\frac{1}{x}$.
Solution: $xy = \int -\frac{1}{x} dx = -\ln x + c$, so $y = -\frac{\ln x}{x} + \frac{c}{x}$. The domain is $0 < x < \infty$. The entire solution is transient (as $c/x$ is transient and $-\frac{\ln x}{x} \to 0$ as $x \to \infty$).
Equation: $y’ – 2y = x^2$
The integrating factor is $e^{\int -2 dx} = e^{-2x}$.
The equation becomes $\frac{d}{dx}[e^{-2x} y] = x^2 e^{-2x}$.
Solution: $e^{-2x} y = \int x^2 e^{-2x} dx = -\frac{1}{2} x^2 e^{-2x} – \frac{1}{2} x e^{-2x} – \frac{1}{4} e^{-2x} + c$.
Thus, $y = -\frac{1}{2} x^2 – \frac{1}{2} x – \frac{1}{4} + ce^{2x}$. The domain is $-\infty < x < \infty$. The transient term is $ce^{2x}$.
Equation: $y’ + \frac{1}{x} y = \sin x$
The integrating factor is $e^{\int (1/x) dx} = x$ (for $x > 0$).
The equation becomes $\frac{d}{dx}[xy] = x \sin x$.
Solution: $xy = \int x \sin x dx = -x \cos x + \sin x + c$.
Thus, $y = -\cos x + \frac{\sin x}{x} + \frac{c}{x}$. The domain is $0 < x < \infty$. The transient term is $c/x$.
Equation: $y’ + \frac{2}{x} y = \frac{\sin x}{x}$
The integrating factor is $e^{\int (2/x) dx} = e^{2\ln|x|} = x^2$.
The equation becomes $\frac{d}{dx}[x^2 y] = x^2 \frac{\sin x}{x} = x \sin x$.
Solution: $x^2 y = \int x \sin x dx = -x \cos x + \sin x + c$.
Thus, $y = -\frac{\cos x}{x} + \frac{\sin x}{x^2} + \frac{c}{x^2}$. The domain is $0 < x < \infty$. The transient term is $c/x^2$.
Equation: $y’ + \frac{4}{x} y = x^2 – 1$
The integrating factor is $e^{\int (4/x) dx} = x^4$.
The equation becomes $\frac{d}{dx}[x^4 y] = (x^2 – 1)x^4 = x^6 – x^4$.
Solution: $x^4 y = \int (x^6 – x^4) dx = \frac{x^7}{7} – \frac{x^5}{5} + c$.
Thus, $y = \frac{x^3}{7} – \frac{x}{5} + cx^{-4}$. The domain is $0 < x < \infty$. The transient term is $cx^{-4}$.
Equation: $y’ – \frac{1}{1+x} y = x$
The integrating factor is $e^{\int -1/(1+x) dx} = e^{-\ln|1+x|} = \frac{1}{|1+x|}$. We use $\frac{1}{1+x}$ for $x > -1$.
The equation becomes $\frac{d}{dx}[\frac{1}{1+x} y] = \frac{x}{1+x} = 1 – \frac{1}{1+x}$.
Solution: $\frac{1}{1+x} y = \int (1 – \frac{1}{1+x}) dx = x – \ln|1+x| + c$.
Thus, $y = (1+x) [x – \ln(1+x) + c]$ for $-1 < x < \infty$. There is no transient term.
Equation: $y’ + (\frac{2}{x} – 1) y = -e^{-x^2}$
The integrating factor is $e^{\int (2/x – 1) dx} = e^{2\ln|x| – x} = x^2 e^{-x}$.
The equation becomes $\frac{d}{dx}[x^2 e^{-x} y] = x^2 e^{-x} (-e^{-x^2}) = -x^2 e^{-x-x^2}$.
The integral $\int -x^2 e^{-x-x^2} dx$ does not have an elementary closed form. Assuming a typo and the RHS was $-2x e^{-x^2}$ (which would yield $e^{-x^2}$ as the particular solution):
If the equation was $y’ + (\frac{2}{x} – 2x) y = -2e^{-x^2}$, IF is $x^2 e^{-x^2}$. $\frac{d}{dx}[x^2 e^{-x^2} y] = -2x^3$. $x^2 e^{-x^2} y = -\frac{1}{2} x^4 + c$. $y = -\frac{1}{2} x^2 e^{x^2} + ce^{x^2}$. The transient term is $ce^{x^2}$.
Based on the provided solution structure $y = \frac{c e^{-x}}{x^2} + \frac{1}{x^2} + e^{-2}$ (which seems related to a different problem or a specific solution): We stick to the IF calculation: IF $= x^2 e^{-x}$. The transient term is $ce^{-x}/x^2$.
Equation: $y’ + (1 + \frac{2}{x}) y = -e^x \sin(2x)$
The integrating factor is $e^{\int (1 + 2/x) dx} = e^{x + 2\ln x} = x^2 e^x$.
The equation becomes $\frac{d}{dx}[x^2 e^x y] = x^2 e^x (-e^x \sin 2x) = -x^2 e^{2x} \sin 2x$.
The integral $\int -x^2 e^{2x} \sin 2x dx$ is complex. Assuming the provided solution structure $y = -\frac{e^{-x} \cos 2x}{2x} + \frac{c}{x^2}$ is derived from a simpler form, we note the transient term is $c/x^2$.
Equation: $\frac{dx}{dy} – \frac{1}{y} x = 4y^3$ (Rewritten as $x’ – \frac{1}{y} x = 4y^3$)
The integrating factor is $e^{\int (-1/y) dy} = e^{-\ln|y|} = \frac{1}{|y|}$. We use $1/y$ for $y > 0$.
The equation becomes $\frac{d}{dy}[\frac{1}{y} x] = 4y^3 \cdot \frac{1}{y} = 4y^2$.
Solution: $\frac{1}{y} x = \int 4y^2 dy = \frac{4}{3} y^3 + c$, so $x = \frac{4}{3} y^4 + cy$. The domain is $0 < y < \infty$. There is no transient term.
Equation: $\frac{dr}{dy} + \frac{2}{y} r = 2$
The integrating factor is $e^{\int (2/y) dy} = y^2$.
The equation becomes $\frac{d}{dy}[y^2 r] = 2y^2$.
Solution: $y^2 r = \int 2y^2 dy = \frac{2}{3} y^3 + c$, so $r = \frac{2}{3} y + \frac{c}{y^2}$. The domain is $0 < y < \infty$. The transient term is $c/y^2$.
Equation: $y’ + (\tan x) y = \sec x$
The integrating factor is $e^{\int \tan x dx} = e^{-\ln|\cos x|} = \sec x$.
The equation becomes $\frac{d}{dx}[(\sec x) y] = \sec^2 x$.
Solution: $(\sec x) y = \int \sec^2 x dx = \tan x + c$, so $y = \frac{\tan x}{\sec x} + \frac{c}{\sec x} = \sin x + c \cos x$. The domain is $-\pi/2 < x < \pi/2$. There is no transient term.
Equation: $2y’ + (\cot x) y = \sec^2 x \csc x$ (or $y’ + \frac{1}{2} (\cot x) y = \frac{1}{2} \sec^2 x \csc x$)
Using the original form: IF $= e^{\int \frac{1}{2} \cot x dx} = e^{\frac{1}{2} \ln|\sin x|} = \sqrt{\sin x}$.
If we use the standard form $y’ + P(x)y = Q(x)$ where $P(x) = \frac{1}{2} \cot x$ and $Q(x) = \frac{1}{2} \sec^2 x \csc x$:
IF $= e^{\int \frac{1}{2} \cot x dx} = \sqrt{\sin x}$.
$\frac{d}{dx}[\sqrt{\sin x} \cdot y] = \sqrt{\sin x} \cdot \frac{1}{2} \sec^2 x \csc x = \frac{1}{2} \frac{1}{\cos^2 x} \frac{1}{\sin x} \sqrt{\sin x} = \frac{1}{2 \cos^2 x \sqrt{\sin x}}$. This integral is complicated.
Using the IF from the text, $e^{\int \cot x dx} = \sin x$, which implies the equation was $y’ + (\cot x) y = \sec x$. Let’s assume the text intended the equation $y’ + (\cot x) y = \sec x$ for the IF $\sin x$:
If $y’ + (\cot x) y = \sec x$, IF $= \sin x$. $\frac{d}{dx}[(\sin x) y] = \sin x \sec x = \tan x$.
Solution: $(\sin x) y = \int \tan x dx = -\ln|\cos x| + c$. $y = -\frac{\ln|\cos x|}{\sin x} + c \csc x$. Domain $0 < x < \pi/2$. Transient term $c \csc x$.
If we use the IF $\sin x$ for the equation $2y’ + (\cot x) y = \sec^2 x \csc x$ (i.e., $y’ + \frac{1}{2} \cot x y = \frac{1}{2} \sec^2 x \csc x$): IF is $\sqrt{\sin x}$.
If we use the IF $\sin x$ for the equation $y’ + (\cot x) y = \sec x$ (as implied by the text’s result $\frac{d}{dx}[(\sin x) y] = \sec x$):
If $\frac{d}{dx}[(\sin x) y] = \sec x$, then $(\sin x) y = \int \sec x dx = \ln|\sec x + \tan x| + c$. $y = \frac{\ln|\sec x + \tan x|}{\sin x} + c \csc x$. Domain $0 < x < \pi/2$. Transient term $c \csc x$.
Equation: $y’ + \frac{x+2}{x+1} y = x+1$
The integrating factor is $e^{\int \frac{x+2}{x+1} dx} = e^{\int (1 + \frac{1}{x+1}) dx} = e^{x + \ln|x+1|} = (x+1)e^x$ (for $x > -1$).
The equation becomes $\frac{d}{dx}[(x+1)e^x y] = (x+1)e^x (x+1) = (x+1)^2 e^x$.
Solution: $(x+1)e^x y = \int (x+1)^2 e^x dx = (x+1)^2 e^x – 2(x+1)e^x + 2e^x + c$.
$y = (x+1) – 2 + \frac{2}{x+1} + c(x+1)^{-1}e^{-x} = x – 1 + \frac{2}{x+1} + c(x+1)^{-1}e^{-x}$. The domain is $-1 < x < \infty$. The transient term is $c(x+1)^{-1}e^{-x}$.
Equation: $y’ + \frac{4}{x+2} y = x+2$
The integrating factor is $e^{\int \frac{4}{x+2} dx} = (x+2)^4$.
The equation becomes $\frac{d}{dx}[(x+2)^4 y] = (x+2)^4 (x+2) = (x+2)^5$.
Solution: $(x+2)^4 y = \int (x+2)^5 dx = \frac{(x+2)^6}{6} + c$.
Thus, $y = \frac{(x+2)^2}{6} + c(x+2)^{-4}$. The domain is $-2 < x < \infty$. The transient term is $c(x+2)^{-4}$.
Equation: $\frac{dr}{d\theta} + (\sec \theta + \tan \theta) r = 1 + \sin \theta$
The integrating factor is $e^{\int (\sec \theta + \tan \theta) d\theta} = e^{\ln|\sec \theta + \tan \theta| + \ln|\sec \theta|} = (\sec \theta + \tan \theta) \sec \theta$. (The text suggests IF $= \sec \theta + \tan \theta$, which implies $P(\theta) = \frac{d}{d\theta} \ln(\sec \theta + \tan \theta) = \sec \theta \tan \theta + \sec^2 \theta$. Let’s use the text’s IF: $e^{\int \sec \theta d\theta} = e^{\ln|\sec \theta + \tan \theta|} = \sec \theta + \tan \theta$.)
Assuming IF $= \sec \theta + \tan \theta$:
$\frac{d}{d\theta}[(\sec \theta + \tan \theta) r] = (1 + \sin \theta)(\sec \theta + \tan \theta) = \sec \theta + \tan \theta + \tan \theta \sec \theta + \sin \theta \tan \theta$.
The text implies $\frac{d}{d\theta}[(\sec \theta + \tan \theta) r] = 1 + \sin \theta$. This would mean $P(\theta) = 0$, which contradicts the equation.
If we assume the equation was $r’ + 0r = 1 + \sin \theta$ and IF $= 1$ (or the equation was $r’ + (\sec \theta) r = \sec \theta$ and IF $= e^{\int \sec \theta d\theta}$):
Using the text’s result: $(\sec \theta + \tan \theta) r = \theta – \cos \theta + c$. Domain $-\pi/2 < \theta < \pi/2$. There is no transient term.
Equation: $P’ + (2t – 1) P = 4t – 2$
The integrating factor is $e^{\int (2t – 1) dt} = e^{t^2 – t}$.
The equation becomes $\frac{d}{dt}[e^{t^2 – t} P] = (4t – 2) e^{t^2 – t} = 2(2t – 1) e^{t^2 – t}$.
Solution: $e^{t^2 – t} P = 2 e^{t^2 – t} + c$, so $P = 2 + ce^{t – t^2}$. The domain is $-\infty < t < \infty$. The transient term is $ce^{t – t^2}$.
Equation: $y’ + (3 + \frac{1}{x}) y = -\frac{1}{x}$
The integrating factor is $e^{\int (3 + 1/x) dx} = e^{3x + \ln x} = x e^{3x}$ (for $x > 0$).
The equation becomes $\frac{d}{dx}[x e^{3x} y] = x e^{3x} (-\frac{1}{x}) = -e^{3x}$.
Solution: $x e^{3x} y = \int -e^{3x} dx = -\frac{1}{3} e^{3x} + c$.
Thus, $y = -\frac{1}{3} e^{-2x} + c x^{-1} e^{-3x}$. The domain is $0 < x < \infty$. The entire solution is transient.
Equation: $y’ + \frac{1}{x-1} y = 1$
The integrating factor is $e^{\int \frac{1}{x-1} dx} = |x-1|$. We use $x-1$ for $x > 1$ or $1-x$ for $x < 1$.
If IF $= x-1$ (for $x>1$): $\frac{d}{dx}[(x-1) y] = x-1$. $(x-1) y = \frac{(x-1)^2}{2} + c$. $y = \frac{x-1}{2} + \frac{c}{x-1}$.
If IF $= 1-x$ (for $x<1$): $\frac{d}{dx}[(1-x) y] = 1-x$. $(1-x) y = x – \frac{x^2}{2} + c$. $y = \frac{x}{1-x} – \frac{x^2}{2(1-x)} + \frac{c}{1-x}$.
The text suggests IF $= -1$ for $y’ + \frac{1}{x-1} y = 1$, which is incorrect for the standard form. If IF $=-1$, then $-y’ – \frac{1}{x-1} y = -1$.
Using the text’s IF $=-1$: $\frac{d}{dx}[-y] = -1$, so $-y = -x + c$, $y = x – c$. This implies $P(x)=0$.
Using the text’s result: $(x-1)y = x(x+1) + c(x+1)$ for $-1 < x < 1$. This implies the equation was $\frac{d}{dx}[(x+1)y] = x^2+x+1$ or similar, which does not match the IF.
Equation: $y’ + \frac{1}{x} y = -e^x$
The integrating factor is $e^{\int (1/x) dx} = x$ (for $x > 0$).
The equation becomes $\frac{d}{dx}[xy] = -x e^x$.
Solution: $xy = \int -x e^x dx = -x e^x + e^x + c$.
Thus, $y = -e^x + \frac{e^x}{x} + \frac{c}{x}$. For $0 < x < \infty$. If $y(1) = 2$, then $2 = -e + e + c$, so $c=2$. $y = -e^x + \frac{e^x + 2}{x}$.
Equation: $\frac{dx}{dy} – \frac{1}{y} x = 2y$
The integrating factor is $e^{\int (-1/y) dy} = 1/y$.
The equation becomes $\frac{d}{dy}[\frac{1}{y} x] = 2y \cdot \frac{1}{y} = 2$.
Solution: $\frac{1}{y} x = 2y + c$, so $x = 2y^2 + cy$. For $0 < y < \infty$. If $y(1) = 5$, then $1 = 2(25) + 5c$, so $5c = 1 – 50 = -49$, $c = -49/5$. $x = 2y^2 – \frac{49}{5} y$.
Equation: $\frac{di}{dt} + \frac{R}{L} i = \frac{E}{L}$
The integrating factor is $e^{\int (R/L) dt} = e^{Rt/L}$.
The equation becomes $\frac{d}{dt}[e^{Rt/L} i] = \frac{E}{L} e^{Rt/L}$.
Solution: $e^{Rt/L} i = \frac{E}{L} \frac{L}{R} e^{Rt/L} + c = \frac{E}{R} e^{Rt/L} + c$.
Thus, $i = \frac{E}{R} + ce^{-Rt/L}$. If $i(0) = i_0$, then $i_0 = E/R + c$, so $c = i_0 – E/R$. $i = \frac{E}{R} + (i_0 – \frac{E}{R}) e^{-Rt/L}$.
Equation: $\frac{dT}{dt} + kT = T_m k$
The integrating factor is $e^{\int k dt} = e^{kt}$.
The equation becomes $\frac{d}{dt}[e^{kt} T] = T_m k e^{kt}$.
Solution: $e^{kt} T = T_m k \frac{1}{k} e^{kt} + c = T_m e^{kt} + c$.
Thus, $T = T_m + ce^{-kt}$. If $T(0) = T_0$, then $T_0 = T_m + c$, so $c = T_0 – T_m$. $T = T_m + (T_0 – T_m)e^{-kt}$.
Equation: $y’ + \frac{2x+1}{x+1} y = 1$
The integrating factor is $e^{\int \frac{2x+1}{x+1} dx} = e^{\int (2 – \frac{1}{x+1}) dx} = e^{2x – \ln|x+1|} = \frac{e^{2x}}{x+1}$.
The equation becomes $\frac{d}{dx}[\frac{e^{2x}}{x+1} y] = \frac{e^{2x}}{x+1}$.
The integral $\int \frac{e^{2x}}{x+1} dx$ is related to the Exponential Integral function $Ei(2x)$.
Using the text’s IF $x+1$: This implies $P(x) = 1/(x+1)$, so the equation should be $y’ + \frac{1}{x+1} y = 1$.
Assuming the equation was $y’ + \frac{1}{x+1} y = 1$ (IF $= x+1$): $\frac{d}{dx}[(x+1) y] = x+1$. $(x+1) y = \frac{(x+1)^2}{2} + c$. $y = \frac{x+1}{2} + \frac{c}{x+1}$. If $y(1) = 10$, $10 = \frac{2}{2} + c/2$, $9 = c/2$, $c=18$. $y = \frac{x+1}{2} + \frac{18}{x+1}$.
Equation: $y’ + (\tan x) y = \cos^2 x$
The integrating factor is $e^{\int \tan x dx} = \sec x$.
The equation becomes $\frac{d}{dx}[(\sec x) y] = \sec x \cos^2 x = \cos x$.
Solution: $(\sec x) y = \int \cos x dx = \sin x + c$.
Thus, $y = \sin x \cos x + c \cos x$. If $y(0) = -1$, then $-1 = 0 + c(1)$, so $c=-1$. $y = \sin x \cos x – \cos x$.
Equation: $y’ + (\cot x) y = \sec^2 x \csc x$
The integrating factor is $e^{\int \cot x dx} = \sin x$.
The equation becomes $\frac{d}{dx}[(\sin x) y] = \sin x (\sec^2 x \csc x) = \sin x \frac{1}{\cos^2 x} \frac{1}{\sin x} = \sec^2 x$.
Solution: $(\sin x) y = \int \sec^2 x dx = \tan x + c$.
Thus, $y = \frac{\tan x}{\sin x} + \frac{c}{\sin x} = \sec x + c \csc x$. There is no transient term.
Piecewise Linear ODE (Example 31)
For $y’ + 2y = f(x)$ with $f(x) = \begin{cases} 1, & 0 < x < 3 \\ 0, & x > 3 \end{cases}$ and $y(0) = 0$. IF $= e^{2x}$.
Interval $0 < x < 3$ ($f(x)=1$): $\frac{d}{dx}[e^{2x} y] = e^{2x}$. $e^{2x} y = \frac{1}{2} e^{2x} + c_1$. $y = \frac{1}{2} + c_1 e^{-2x}$.
Using $y(0) = 0$: $0 = 1/2 + c_1$, so $c_1 = -1/2$. $y = \frac{1}{2} (1 – e^{-2x})$ for $0 < x < 3$.
At $x=3$, $y(3^-) = \frac{1}{2} (1 – e^{-6})$.
Interval $x > 3$ ($f(x)=0$): $\frac{d}{dx}[e^{2x} y] = 0$. $e^{2x} y = c_2$. $y = c_2 e^{-2x}$.
For continuity at $x=3$: $c_2 = y(3^-) = \frac{1}{2} (1 – e^{-6})$.
Solution: $y = \begin{cases} \frac{1}{2} (1 – e^{-2x}), & 0 \le x < 3 \\ \frac{1}{2} (1 – e^{-6}) e^{-2x}, & x \ge 3 \end{cases}$
