Monday, February 22, 2016

A special type of differential equation I

Question:
(1) Find the general solution of
$\frac{dy}{dx}+P(x)y=Q(x)$, where $P(x)$ and $Q(x)$ are functions of $x$.
(2) Solve the following differential equation:
$x\frac{dy}{dx}+2y=\sin x$

Answer:
(1) Multiply $e^{\int P(x)dx}$ by both sides.
\[
e^{\int P(x)dx}\frac{dy}{dx}+P(x)e^{\int P(x)dx}y=e^{\int P(x)dx}Q(x)
\]
We can notice that the left hand side can be modified as follows:
\[
\frac{d}{dx}\left(e^{\int P(x)dx}y\right) = e^{\int P(x)dx}Q(x)
\]
Integrate both sides in terms of $x$.
\begin{eqnarray*}
e^{\int P(x)dx}y &=& \int e^{\int P(x)dx}Q(x)dx + C \\
y &=& e^{-\int P(x)dx}\left(\int e^{\int P(x)dx}Q(x)dx + C \right)
\end{eqnarray*}

The other solution of (1) When $Q(x) = 0$, the solution is $y=Ce^{-\int P(x)dx}$. Therefore, when $Q(x) \neq 0$, the constant $C$ can be a function of $x$ and then find the $C(x)$. $y=Ce^{-\int P(x)dx}$ can be plugged in the original equation:
\begin{eqnarray*}
\frac{d}{dx}Ce^{-\int P(x)dx}+P(x)y&=&Q(x)  \\
C'e^{-\int P(x)dx}-CP(x)e^{-\int P(x)dx}+P(x)y&=&Q(x) \\
C'e^{-\int P(x)dx}-P(x)y+P(x)y&=&Q(x) \\
C'&=&Q(x)e^{\int P(x)dx}  \\
C(x) &=& \int Q(x)e^{\int P(x)dx}dx+C
\end{eqnarray*}
Since $C(x)=e^{\int P(x)dx}y$, we have
\begin{eqnarray*}
e^{\int P(x)dx}y &=& \int Q(x)e^{\int P(x)dx}dx+C \\
y &=& e^{-\int P(x)dx}\left(\int Q(x)e^{\int P(x)dx}dx+C \right)
\end{eqnarray*}

(2) The given equation can be modified as
\[
\frac{dy}{dx}+\frac{2y}{x}=\frac{\sin x}{x}
\]
From the previous discussion, $P(x)=2/x$ and $Q(x)=\sin x/x$. So plug them in to the previous result.
\[
y = e^{-\int \frac{2}{x}dx}\left(\int \frac{\sin x}{x}e^{\int \frac{2}{x}dx}dx+C \right)
\]
Think about the function $f(x)=e^{-\int \frac{2}{x}dx}$. This becomes $f(x)=e^{-2\ln x}$. In order to simplify it, take log of both sides.
\begin{eqnarray*}
\ln f(x) &=& \ln e^{-2\ln x}  \\
\ln f(x) &=& -2\ln x  \\
\ln f(x) &=& \ln x^{-2}  \\
f(x) &=& x^{-2}
\end{eqnarray*}
Thus, we have
\[
y = \frac{1}{x^2}\left(\int \frac{\sin x}{x}x^2 dx+C \right)
\]
For the final steps,
\begin{eqnarray}
y &=& \frac{1}{x^2}\left(\int x\sin x dx+C \right)  \\
&=&  \frac{1}{x^2}\left([-x\cos x + \int\cos x dx]+C \right)  \\
&=&  \frac{1}{x^2}\left(-x\cos x + \sin x + C \right)
\end{eqnarray}

Powered by Hirophysics.com

No comments:

Post a Comment