Question
Solve the differential equation
$\frac{dy}{dx} = x + y,$
given that $y = 2$ when $x = 0$.
Give your answer in the form $y = f(x)$.
▶️Answer/Explanation
Detailed solution
The equation \(\frac{dy}{dx} = x + y\) suggests a substitution that relates \(x\) and \(y\). A common substitution for this type of linear differential equation is:
\[ v = x + y \]
Then, \(y = v – x\), and we need to find \(\frac{dy}{dx}\) in terms of \(v\). Differentiate both sides of \(v = x + y\) with respect to \(x\):
\[ \frac{dv}{dx} = \frac{d}{dx}(x + y) = 1 + \frac{dy}{dx} \]
Substitute \(\frac{dy}{dx} = x + y\) from the original equation:
\[ \frac{dv}{dx} = 1 + (x + y) \]
Since \(v = x + y\), this becomes:
\[ \frac{dv}{dx} = 1 + v \]
\[ \frac{dv}{dx} = 1 + v \]
This is separable. Rewrite it as:
\[ \frac{dv}{1 + v} = dx \]
Integrate both sides:
Left side: \(\int \frac{dv}{1 + v} = \ln|1 + v| + C_1\)
Right side: \(\int dx = x + C_2\)
So:
\[ \ln|1 + v| = x + C \]
where \(C = C_2 – C_1\) is a constant. Exponentiate both sides to solve for \(v\):
\[ |1 + v| = e^{x + C} = e^x \cdot e^C \]
Let \(A = e^C\), where \(A > 0\), and account for the absolute value:
\[ 1 + v = \pm e^C e^x = A e^x \], Then:
\[ v = A e^x – 1 \]
Since \(v = x + y\), substitute back:
\[ x + y = A e^x – 1 \]
\[ y = A e^x – 1 – x \]
Use the initial condition \(y = 2\) when \(x = 0\):
\[ 2 = A e^0 – 1 – 0 \]
\[ 2 = A – 1 \]
\[ A = 3 \]
So the solution is:
\[ y = 3 e^x – 1 – x \]
………………Markscheme……………………
Solution: –
$\frac{dy}{dx}-y=x$
recognition that an integrating factor is required
$e^{\int P(x)dx}(=e^{\int -1dx})$
$=e^{-x}$
$e^{-x}\frac{dy}{dx}-e^{-x}y=xe^{-x}$
$e^{-x}y(=\int xe^{-x}dx)$
attempt to integrate right hand side using integration by parts
$(e^{-x}y=)-xe^{-x}+\int e^{-x}dx$
$=-xe^{-x}-e^{-x}+c$
$y=-x-1+ce^{x}$
substitute initial values y=2 and x=0 into an integrated expression involving c
$2=-1+c\Rightarrow c=3$
$y=3e^{x}-x-1$