# Solve the differential equation. {eq}\displaystyle y' + y = \dfrac {1 - e^{-2 x}}{e^{-x} + e^{-x}} {/eq}

## Question:

Solve the differential equation.

{eq}\displaystyle y' + y = \dfrac {1 - e^{-2 x}}{e^{-x} + e^{-x}} {/eq}

## Linear First-Order Differential Equation:

The given linear first-order differential equation can be solved by using an integrating factor {eq}\mu (x) {/eq}. For a given linear differential equation {eq}\displaystyle y' + P y = Q {/eq}, the general solution can be determined as follows:

{eq}\displaystyle y \times \mu (x) = \displaystyle \int Q(x) \times \mu (x) \ dx {/eq}

Here, the integrating factor {eq}\displaystyle \mu (x) = \displaystyle e^{\int P dx} {/eq}

We are given that:

{eq}\displaystyle y' + y = \dfrac {1 - e^{-2 x}}{e^{-x} + e^{-x}} {/eq}

We first find the integrating factor for the above differential equation.

{eq}\displaystyle \mu (x) = \displaystyle e^{\int dx} = e^x {/eq}

Hence, the general solution of the given differential equation is:

{eq}\displaystyle y \times \mu (x) = \displaystyle \int \dfrac {1 - e^{-2 x}}{e^{-x} + e^{-x}} \times \mu (x) \ dx \\ \begin{align*} \Rightarrow \displaystyle y \times e^x & = \displaystyle \int \dfrac {1 - e^{-2 x}}{2e^{-x}} \times e^x \ dx \\ & = \displaystyle \frac{1}{2} \times \int e^{2x} (1 - e^{-2 x}) \ dx \\ & = \displaystyle \frac{1}{2} \int (e^{2x} - 1) \ dx \\ & = \dfrac{e^{2x}}{4} - \dfrac{x}{2} + C \\ \end{align*} \\ \Rightarrow \displaystyle y = \dfrac{e^{x}}{4} - \frac{xe^{-x}}{2} + C e^{-x} \ \text{, where C is the constant of integration. } {/eq}