# Finding a Function from Differential Equation

The solution of a differential equation is to find an expression without $\displaystyle \frac{d}{dx}$ notations using given conditions.
Note that the proper rules must be in place in order to achieve the valid solution of the differential equations, such as product rule, quotient rule and chain rule particularly.
Many students missed applying the chain rule which resulted in an unexpected outcome of the differential equation.
Take a look at the following example for a typical differential equation.

## Question 1

A function $f(x)$ is defined for all real $x$ and $y$ such that $\require{color} f(x + y) = f(x)f(y) \text{ , and } f'(0) = 2$.
Find $f(x)$ in terms of $x$.

\begin{aligned} f(y) &= f(0)f(y) &\color{green} \text{substitute } x=0 \\ \therefore f(0)&=1 &\color{green} (1) \\ \frac{d}{dx}f(x + y) \times \frac{d}{dx}(x + y) &= \frac{d}{dx}f(x) \times f(y) + f(x) \times \frac{d}{dx}f(y) &\color{green} \text{differentiate both sides} \\ \frac{d}{dx}f(x + y) \times (1 + \frac{dx}{dy}) &= \frac{d}{dx}f(x) \times f(y) + f(x) \times \frac{d}{dx}f(y) \times \frac{dy}{dx} &\color{green} \frac{dy}{dx} = y’ \\ f'(x + y) \times (1 + y’) &= f'(x) \times f(y) + f(x) \times f'(y) \times y’ \\ f'(y) \times (1 + y’) &= f'(0) \times f(y) + f(0) \times f'(y) \times y’ &\color{green} \text{substitute } x=0 \\ f'(y) \times (1 + y’) &= 2 \times f(y) + f(0) \times f'(y) \times y’ &\color{green} \text{substitute } f'(0) = 2 \\ f'(y) + f'(y) y’ &= 2 f(y) + 1 \times f'(y) y’ &\color{green} \text{substitute } f(0) = 1 \\ f'(y) &= 2 f(y) \\ \frac{f'(y)}{f(y)} &=2 \\ \int \frac{f'(y)}{f(y)} \,dy &= \int 2 \,dy &\color{green} \text{integrate both sides} \\ \log_e f(y) &= 2y + C &\color{green} (2) \\ \log_e f(0) &= 2 \times 0 + C &\color{green} \text{substitute } y = 0 \\ \log_e 1 &= C &\color{green} \text{substitute } f(0) = 1 \\ \log_e f(y) &= 2y &\color{green} (2) \\ f(y) &= e^{2y} \\ \therefore f(x) &= e^{2x} \\ \end{aligned}

## Question 2

Consider a differential equation, $\displaystyle \frac{d^2y}{dt^2} + 3\frac{dy}{dt} + 2y = 0$.

(a)   Show that, if $y = f(t)$ and $y = g(t)$ are both solutions to the differential equation and $A$ and $B$ are constants, then $y = Af(t) + Bg(t)$ is a solution.

If $y = f(t)$ is a solution of $\require{color} \displaystyle \frac{d^2y}{dt^2} + 3\frac{dy}{dt} + 2y = 0$, then $\displaystyle \frac{d^2}{dt}f(t) +3\frac{d}{dt}f(t) + 2f(t) = 0 \color{green} \cdots (1)$
If $y = g(t)$ is a solution of $\require{color} \displaystyle \frac{d^2y}{dt^2} + 3\frac{dy}{dt} + 2y = 0$, then $\displaystyle \frac{d^2}{dt}g(t) +3\frac{d}{dt}g(t) + 2g(t) = 0 \color{green} \cdots (2)$
\begin{aligned} \displaystyle \require{color} y &= Af(t) + Bg(t) \cdots \color{green} (3) \\ \frac{dy}{dt} &= A\frac{d}{dt}f(t)+B\frac{d}{dt}g(t) \cdots \color{green} (4) \\ \frac{d^2y}{dt^2} &= A\frac{d^2}{dt^2}f(t)+B\frac{d^2}{dt^2}g(t) \cdots \color{green} (5) \\ \end{aligned}
\begin{aligned} \displaystyle \require{color} A\frac{d^2}{dt^2}f(t)+ B\frac{d^2}{dt^2}g(t) + 3A\frac{d}{dt}f(t)+3B\frac{d}{dt}g(t) + 2Af(t) + 2Bg(t) &= 0 &\color{green} (3), (4), (5) \text{ into } \frac{d^2y}{dt^2} + 3\frac{dy}{dt} + 2y = 0 \\ A \Big[\frac{d^2}{dt^2}f(t)+3\frac{d}{dt}f(t)+ 2f(t)\Big]+ B \Big[\frac{d^2}{dt^2}g(t) +3\frac{d}{dt}g(t) + 2g(t)\Big] &= 0 \\ A \times 0 + B \times 0 &= 0 &\color{green} \text{by (1) and (2)} \\ \therefore y = Af(t) + Bg(t) \text{ is a solution of } \frac{d^2y}{dt^2} + 3\frac{dy}{dt} + 2y &= 0 \\ \end{aligned}

(b)   A solution of the differential equation is given by $y = e^{kt}$ for some values $k$. Find the possible values of $k$.

\begin{aligned} \displaystyle \require{color} k^2e^{kt} + 3ke^{kt} + 2e^{kt} &= 0 \\ e^{kt}(k^2 + 3k + 2) &= 0 \\ e^{kt}(k + 1)(k + 2) &= 0 \\ \therefore k &= -1 \text{ or } -2 &\color{green} e^{kt} \ne 0 \\ \end{aligned}

(c)   A solution of the differential equation is $y = Ae^{-2t} + Be^{-t}$. When $t=0$, it is given that $y=0$ and $\displaystyle \frac{dy}{dx} = 1$. Find the values of $A$ and $B$.

\begin{aligned} \displaystyle \require{color} 0 &= Ae^{-2 \times 0} + Be^{-0} &\color{green} t=0 \text{ and } y=0 \\ 0 &= A + B &\color{green} (1) \\ \frac{dy}{dx} &= -2Ae^{-2t} – Be^{-t} \\ 1 &= -2Ae^{-2 \times 0} – Be^{-0} &\color{green} t=0 \text{ and } \frac{dy}{dx} = 1 \\ 1 &= -2A – B &\color{green} (2) \\ \therefore A &= -1 \text{ and } B = 1 &\color{green} \text{solve (1) and (2) simultaneously} \end{aligned} 