Differential equations: exercises
===
[TOC]
## Solved exercise 1: primitives
For each of these functions, calculate a primitive and precise the domain of definition.
1. $f(t) = \cos t$
2. $f(t) = \tan t$
3. $f(t) = 4t+5$
4. $f(t) = \frac{2}{t \ln t}$
5. $f(t) = e^{-5t} + t^3$
6. $f(t) = \sqrt{2t+1}$
7. $f(t) = \ln t / t$.
::: spoiler Correction
$C$ is an arbitrary constant in $\mathbb R$.
1. $F(t) = \sin t + C$ on $\mathbb{R}$.
2. $\tan =- u'/u$ with $u(t) = \cos t$. So a primitive is $-\ln |u|$, hence $F(t) = -\ln |\cos t| + C$ on each interval $]-\pi/2 + k\pi, \pi/2 + k\pi[$ where $k$ is an integer.
3. $F(t) = 2t^2 + 5t + C$ on $\mathbb R$
4. $f = 2 u' / u$ with $u = \ln$ so $F(t) = 2 \ln(\ln t) + C$ on $]1, +\infty[$ and $F(t) = 2 \ln(-\ln t) + C$ on $]0,1[$ are primitives of $f$ on disjoint intervals.
5. $F(t) = -\frac{1}{5}e^{-5t} + \frac{1}{4}t^4 + C$ on $\mathbb{R}$.
6. $(at+b)^{\alpha}$ with $\alpha > 0$ and $a\neq 0$ has for primitive: $\frac{1}{a(\alpha+1)} (at+b)^{\alpha+1}+ C$. So, here $F(t) = \frac{1}{3} (2t+1)^{3/2} + C$ on $[-1/2, +\infty]$.
7. $f = u' \times u$ with $u(t) = \ln t$, which s=is defined and differentiable $]0,+\infty[$, so its primitives are $F(t) = (\ln t)^2/2+ C$ on this interval.
:::
## Reminder
:::info
**Course reminder for solving linear ODE of order 1.**
Let us consider an ODE of the form:
\begin{equation}
f'(t) + a(t) f(t) = b(t)
\end{equation}
with an initial condition $f(0) = x_0$.
$b(t)$ is called the second term.
* **Step 1.** Solve the homogeneous differential equation, i.e. the differential equation without a second member:
\begin{equation}
(\text{H})\qquad f'(t) + a f(t) = 0
\end{equation}
The general solution of (H) is
\begin{equation}
f_H(t) = C e^{-A(t)}
\end{equation}
where $A$ is a primitive function of $a$.
* **Step 2.** Find a **particular** solution of the equation with second term. For this, use the method of variation of parameters.
Seek for an solution of the form
\begin{equation}
f_P(t) = C(t) e^{-A(t)}
\end{equation}
that has to satisfy the original equation, with second term. Note that with this form, the derivative of $f_P$ is:
\begin{equation}
f'_P(t) = C'(t) e^{-A(t)} - a(t) C(t) e^{-A(t)}.
\end{equation}
The general solution of the equation is then:
\begin{equation}
f(t) = f_H(t) + f_P(t)
\end{equation}
* **Step 3.** Using the initial condition $f(0) = x_0$, find the value of the constant in $f_H$.
:::
## Solved exercise 2: Order 1 with constant coefficients
Solve these differential equations with the initial conditions (Cauchy problems).
1. $f' + 6f = 0$ avec $f(0) = -1$,
2. $f' - f/4 = 0$ avec $f(1) = 2$,
3. $f' - 2f = 2$ avec $f(0) = 0$,
4. $f' + f = \frac{1}{1+e^t}$ avec $f(0) = 1$,
5. $f' + 5f - t^2 + t - 4 = 0$ avec $f(0) = 0$.
:::spoiler Hint for 5.
Seek for a particular solution as a second order polynomial.
:::spoiler Correction
1. The solutions of the EDO are $f(t) = Ce^{-6t}$ with $C$ a constant. The condition $f(0) = -1$ implies $C = -1$ so the unique solution to the problem is $f(t) = -e^{-6t}$.
2. $f(t) = 2 e^{(t-1)/4}.$
3. Solutions of the homogeneous equation (without second term) $f_H(t) = Ce^{2t}$. Let us look for a particular solution with a second member. In this particular case, we can look for a constant function $f_P(t) = k$ is a solution if $-2k = 2$ so $f_P(t) = -1$ is a particular solution.
Finally the solutions are $f(t) = f_H(t) + f_P(t) = Ce^{2t}-1$. The initial condition $f(0) = 0$ implies $C = 1$ hence the solution to the problem is : $f(t) = e^{2t}-1$.
4. Solutions to the homogeneous ODE are $C e^{-t}$. Using the method of variation of parameter, let us look for a particular solution of the ODE with second term $f_P(t) = k(t) e^{-t}$. The equation becomes
\begin{equation}
k'(t) e^{-t} - k(t) e^{-t} + k(t) e^{-t} = \frac{1}{1+e^{t}} \Leftrightarrow k'(t) = \frac{e^{t}}{1+e^{t}}.
\end{equation}
$k'$ looks like $u'/u$ with $u(t) = 1+e^{t}$. The function $k(t) = \ln(1+e^{t})$ works, so we have $f_P = \ln(1+e^{t})e^{-t}$. Hence the solution to the problem is $f(t) = (C + \ln(1+e^{t}))e^{-t}$ and with the inital condition we find $C = 1-\ln 2$.
The solution is
\begin{equation}
f(t) = \left(1+\ln \left(\frac{1+e^{t}}{2}\right)\right) e^{-t}.
\end{equation}
5. The solutions of the homogeneous equation are $f_H(t) = Ce^{-5t}$. The second term is polynomial, let us seek for a polynomial particular solution : $f_P(t) = \alpha t^2 + \beta t + \gamma$.
\begin{align*}
f'_P(t) + 5f_P(t) - t^2 + t - 4 = 0 &\Leftrightarrow 2 \alpha t + \beta + 5 \alpha t^2+ 5\beta t + 5\gamma - t^2 + t - 4 = 0 \\
&\Leftrightarrow (5\alpha-1)t^2 + (2\alpha+5\beta+1) t + \beta +5\gamma - 4 = 0 \\
& \Leftrightarrow \begin{cases}
5\alpha -1 = 0 \\
2\alpha + 5 \beta + 1 = 0 \\
\beta + 5 \gamma - 4 = 0
\end{cases} \quad \text{(note }^1\text{)}\\
& \Leftrightarrow \begin{cases}
\alpha=\frac{1}{5}\\
\beta = \frac{-7}{25}\\
\gamma = \frac{107}{125}
\end{cases}.
\end{align*}
<sup>1:</sup> a polynomial $P(t)$ is zero for all $t$ if and only if all its coefficients are 0.
Finally, the solutions have the general form $f(t) = Ce^{-5t} + \frac{1}{125} (25t^2 - 35 t + 107)$. With the initial condition we find $C = - \frac{107}{125}$ so the solution to the problem is:
\begin{equation}
f(t) = \frac{1}{125} (25t^2 - 35 t + 107-107e^{-5t}).
\end{equation}
:::
## Exercise 3: Order 1 with non constant coefficients
Solve these ODE:
1. $f' + 3t^2 f = 0$ on $\mathbb{R}$,
2. $f' - \frac{3}{t} f = t^2$ on $]0,+\infty[$.
3. $t^2 f' - f = (t^2 - 1) e^{t}$ on $]-\infty, 0[$ and on $]0, +\infty[$.
4. *More difficult* $(1-t) f' + f = \frac{t-1}{t}$ on $]1, +\infty[$.