# What is the general solution of the differential equation? :  (d^2y)/(dx^2)- y = 1/(1+e^x)

Sep 4, 2017

$y \left(x\right) = A {e}^{x} + B {e}^{- x} - \frac{1}{2} x {e}^{x} - \frac{1}{2} - \frac{1}{2} {e}^{x} \ln \left(1 + {e}^{x}\right) - \frac{1}{2} {e}^{-} x \ln \left(1 + {e}^{x}\right)$

#### Explanation:

We have:

$\frac{{d}^{2} y}{{\mathrm{dx}}^{2}} - y = \frac{1}{1 + {e}^{x}}$ ..... [A]

This is a second order linear non-Homogeneous Differentiation Equation. The standard approach is to find a solution, ${y}_{c}$ of the homogeneous equation by looking at the Auxiliary Equation, which is the quadratic equation with the coefficients of the derivatives, and then finding an independent particular solution, ${y}_{p}$ of the non-homogeneous equation.

Complementary Function

The homogeneous equation associated with [A] is

$y ' ' - y = 0$

And it's associated Auxiliary equation is:

${m}^{2} - 1 = 0$

Which has distinct real solutions $m = \pm 1$

Thus the solution of the homogeneous equation is:

${y}_{c} = A {e}^{x} + B {e}^{- x}$

Particular Solution

With this particular equation [A], the interesting part is find the solution of the particular function. We would typically use practice & experience to "guess" the form of the solution but that approach is likely to fail here. Instead we must use the Wronskian (or variation of parameters). It does, however, involve a lot more work:

Once we have two linearly independent solutions say ${y}_{1} \left(x\right)$ and ${y}_{2} \left(x\right)$ then the particular solution of the general DE;

$a y ' ' + b y ' + c y = p \left(x\right)$

is given by:

${y}_{p} = {v}_{1} {y}_{1} + {v}_{2} {y}_{2} \setminus \setminus$, which are all functions of $x$

Where:

${v}_{1} = - \int \setminus \frac{p \left(x\right) {y}_{2}}{W \left[{y}_{1} , {y}_{2}\right]} \setminus \mathrm{dx}$
${v}_{2} = \setminus \setminus \setminus \setminus \setminus \int \setminus \frac{p \left(x\right) {y}_{1}}{W \left[{y}_{1} , {y}_{2}\right]} \setminus \mathrm{dx}$

And, $W \left[{y}_{1} , {y}_{2}\right]$ is the wronskian; defined by the following determinant:

$W \left[{y}_{1} , {y}_{2}\right] = | \left({y}_{1} , {y}_{2}\right) , \left({y}_{1} ' , {y}_{2} '\right) |$

So for our equation [A]:

$p \left(x\right) = \frac{1}{1 + {e}^{x}}$
${y}_{1} \setminus \setminus \setminus = {e}^{x} \setminus \setminus \setminus \implies {y}_{1} ' = {e}^{x}$
${y}_{2} \setminus \setminus \setminus = {e}^{- x} \implies {y}_{2} ' = - {e}^{-} x$

So the wronskian for this equation is:

$W \left[{y}_{1} , {y}_{2}\right] = | \left({e}^{x} , , {e}^{-} x\right) , \left({e}^{x} , , - {e}^{-} x\right) |$
$\text{ } = \left({e}^{x}\right) \left(- {e}^{-} x\right) - \left({e}^{x}\right) \left({e}^{-} x\right)$
$\text{ } = - 2$

So we form the two particular solution function:

${v}_{1} = - \int \setminus \frac{p \left(x\right) {y}_{2}}{W \left[{y}_{1} , {y}_{2}\right]} \setminus \mathrm{dx}$

$\setminus \setminus \setminus = - \int \setminus \frac{\frac{1}{1 + {e}^{x}} \left({e}^{-} x\right)}{- 2} \setminus \mathrm{dx}$
$\setminus \setminus \setminus = \frac{1}{2} \setminus \int \setminus {e}^{-} \frac{x}{1 + {e}^{x}} \setminus \mathrm{dx}$

We can evaluate this integral using a substitution:

Let $u = {e}^{x} \implies \frac{\mathrm{du}}{\mathrm{dx}} = {e}^{x}$ and ${e}^{- x} = \frac{1}{u}$ then
${v}_{1} = \frac{1}{2} \setminus \int \setminus \frac{\frac{1}{u}}{1 + u} \setminus \left(\frac{1}{u}\right) \setminus \mathrm{du}$
$\setminus \setminus \setminus = \frac{1}{2} \setminus \int \setminus \frac{1}{{u}^{2} \left(1 + u\right)} \setminus \mathrm{du}$

No we decompose the integrand into partial fractions:

$\frac{1}{{u}^{2} \left(1 + u\right)} \equiv \frac{a}{u} + \frac{b}{u} ^ 2 + \frac{c}{1 + u}$
$\text{ } = \frac{a u \left(1 + u\right) + b \left(1 + u\right) + c {u}^{2}}{{u}^{2} \left(1 + u\right)}$
$\implies 1 \equiv a u \left(1 + u\right) + b \left(1 + u\right) + c {u}^{2}$

Where $a , b , c$ are constants to be determine. Using substitution we have:

Put $u = 0 \implies 1 = b$
Put $u = - 11 \implies 1 = c$
Coeff$\left({u}^{2}\right) : 0 = a + c \implies a = - 1$

Thus:

${v}_{1} = \frac{1}{2} \setminus \int \setminus - \frac{1}{u} + \frac{1}{u} ^ 2 + \frac{1}{1 + u} \setminus \mathrm{du}$
$\setminus \setminus \setminus = \frac{1}{2} \setminus \left\{- \ln | u | - \frac{1}{u} + \ln | 1 + u |\right\}$
$\setminus \setminus \setminus = \frac{1}{2} \setminus \left\{- \ln | {e}^{x} | - \frac{1}{e} ^ x + \ln | 1 + {e}^{x} |\right\}$
$\setminus \setminus \setminus = \frac{1}{2} \setminus \left\{- x - {e}^{-} x + \ln \left(1 + {e}^{x}\right)\right\}$
$\setminus \setminus \setminus = - \frac{1}{2} x - \frac{1}{2} {e}^{-} x + \frac{1}{2} \ln \left(1 + {e}^{x}\right)$

And;

${v}_{2} = \setminus \setminus \setminus \setminus \setminus \int \setminus \frac{p \left(x\right) {y}_{1}}{W \left[{y}_{1} , {y}_{2}\right]} \setminus \mathrm{dx}$

$\setminus \setminus \setminus = \int \setminus \frac{\frac{1}{1 + {e}^{x}} {e}^{x}}{- 2} \setminus \mathrm{dx}$
$\setminus \setminus \setminus = - \frac{1}{2} \setminus \int \setminus \frac{{e}^{x}}{1 + {e}^{x}} \setminus \mathrm{dx}$

We can similarly evaluate this integral using a substitution:

Let $u = {e}^{x} \implies \frac{\mathrm{du}}{\mathrm{dx}} = {e}^{x}$ then
${v}_{2} = - \frac{1}{2} \setminus \int \setminus \frac{u}{1 + u} \setminus \left(\frac{1}{u}\right) \setminus \mathrm{du}$
$\setminus \setminus \setminus = - \frac{1}{2} \setminus \int \setminus \frac{u}{1 + u} \setminus \left(\frac{1}{u}\right) \setminus \mathrm{du}$
$\setminus \setminus \setminus = - \frac{1}{2} \setminus \int \setminus \frac{1}{1 + u} \setminus \mathrm{du}$
$\setminus \setminus \setminus = - \frac{1}{2} \setminus \ln | 1 + u |$
$\setminus \setminus \setminus = - \frac{1}{2} \setminus \ln | 1 + {e}^{x} |$
$\setminus \setminus \setminus = - \frac{1}{2} \setminus \ln \left(1 + {e}^{x}\right)$

And so we form the Particular solution:

${y}_{p} = {v}_{1} {y}_{1} + {v}_{2} {y}_{2}$
$\setminus \setminus \setminus = \left(- \frac{1}{2} x - \frac{1}{2} {e}^{-} x + \frac{1}{2} \ln \left(1 + {e}^{x}\right)\right) \left({e}^{x}\right) + \left(- \frac{1}{2} \setminus \ln \left(1 + {e}^{x}\right)\right) \left({e}^{-} x\right)$

$\setminus \setminus \setminus = - \frac{1}{2} x {e}^{x} - \frac{1}{2} - \frac{1}{2} {e}^{x} \ln \left(1 + {e}^{x}\right) - \frac{1}{2} {e}^{-} x \ln \left(1 + {e}^{x}\right)$

Which then leads to the GS of [A}

$y \left(x\right) = {y}_{c} + {y}_{p}$
$\setminus \setminus \setminus \setminus \setminus \setminus \setminus = A {e}^{x} + B {e}^{- x} - \frac{1}{2} x {e}^{x} - \frac{1}{2} - \frac{1}{2} {e}^{x} \ln \left(1 + {e}^{x}\right) - \frac{1}{2} {e}^{-} x \ln \left(1 + {e}^{x}\right)$