# Question #5b598

Jan 20, 2017

$y = x - 1 + 5 {e}^{- x}$

#### Explanation:

Linear differential eqn of type

$\frac{\mathrm{dy}}{\mathrm{dx}} + P y = Q$

where $P , Q$ are either constants or functions of $x$

we use an integrating factor

$I F = {e}^{\int \left(P \mathrm{dx}\right)}$

in this case $P = 1$

$\frac{\mathrm{dy}}{\mathrm{dx}} + y = x$

$I F = {e}^{\int \mathrm{dx}} = {e}^{x}$

multiply the ode by $I F$

${e}^{x} \frac{\mathrm{dy}}{\mathrm{dx}} + {e}^{x} y = x {e}^{x}$

LHS is the result of the product rule for differentiation

$\frac{d}{\mathrm{dx}} \left({e}^{x} y\right) = x {e}^{x}$

Integrating both sides wrt $x$

${e}^{x} y = \int \left(x {e}^{x}\right) \mathrm{dx}$

RHS is integrated by parts

${I}_{R H S} = u v - \int v u ' \mathrm{dx}$

$u = x \implies u ' = 1$
$v ' = {e}^{x} \implies v = {e}^{x}$

so

${e}^{x} y = x {e}^{x} - \int {e}^{x} \mathrm{dx}$

${e}^{x} y = x {e}^{x} - {e}^{x} + C$

to find the constant we use the boundary condition

$y \left(0\right) = 4$

${e}^{0} \times 4 = 0 \times {e}^{0} - {e}^{0} + C$

$4 = - 1 + C \implies C = 5$

${e}^{x} y = x {e}^{x} - {e}^{x} + 5$

tidy up by $\times {e}^{- x}$

$y = x - 1 + 5 {e}^{- x}$

Jan 20, 2017

$y = 5 {e}^{-} x + x - 1$

#### Explanation:

First solve $\frac{\mathrm{dy}}{\mathrm{dx}} + y = 0$ by separable variables:
$\int \frac{\mathrm{dy}}{y} = - \int 1 \mathrm{dx}$

$\ln y = - x + \ln A$ where $\ln A$ is the arbitrary constant of integration

Hence $y = A {e}^{-} x$ (by raising $e$ to the power of each side).
Now for the steady state, set spot that y=x-1 is a particular solution of the original equation on the left. (Or try out $y \equiv a x + b$ and equate coefficients to find $a$ and $b$.) So the general solution is:
$y = A {e}^{-} x + x - 1$ with $A$ chosen to make $y \left(0\right) = 4$:
$4 = A {e}^{0} + 0 - 1$ so $A = 5$ and the final solution is:

$y = 5 {e}^{-} x + x - 1$

Check:
$\frac{\mathrm{dy}}{\mathrm{dx}} + y = \left(\cancel{\left(- 5\right) {e}^{x}} + \cancel{1} - 0\right) + \left(\cancel{5 {e}^{-} x} + x - \cancel{1}\right) = x$
and
$y \left(0\right) = 5 {e}^{0} + 0 - 1 = 5 \times 1 - 1 = 4$