# First-order linear equations (plus 1 assignment about integration)

Im working on this equation without the use of CAS-tool: $$\frac{{\rm d}y}{{\rm d}x} + 2xy = e^x$$ the corresponding homogeneous equation would then be: $\frac{{\rm d}y}{{\rm d}x} + 2xy = 0$ which has the general solution: $$y=Ke^{-\mu(x)}$$ where $K$ is a constant and $\mu(x)$ is any antiderivative of $p(x)$.

My 1st question is then: where does $K$ come from? It is not a integration constant, cause then it would have been a sum and not a factor.

Then I have to calculate: $\frac{\rm d}{{\rm d}x}(e^{\mu(x)}y)$ by the product rule - which I interpret as treating y as a function, and not a constant.

Then I have to show that the left side is $\frac{\rm d}{{\rm d}x}(e^{\mu(x)}y)$ in this equation:

$$e^{\mu(x)}\big(\textstyle{\frac{{\rm d}y}{{\rm d}x}} + 2xy\big) = e^x\cdot e^μ(x)$$ which is simply just the 1st equation multiplied by $e^{\mu(x)}$ on both sides.

The hard part is to combine these to equations: the 1st one: $\frac{{\rm d}y}{{\rm d}x} + 2xy=e^x$ and the one I just calculated: $e^{\mu(x)}\big(\textstyle{\frac{{\rm d}y}{{\rm d}x}} + 2xy\big) = e^x\cdot e^μ(x)$ then integrate and determine K and derby the specific solution to the 1st equation. How do I do that?

Last thing is how to show that this specific solution can be written as $$y(x) = e^{-\mu(x)}\int e^{\mu(x)} q(x)\,{\rm d}x$$

And extra assignment is to: calculate $$\lim_{n\to\infty}\sum_{i=1}^n \frac{n}{i^2+n^2}$$

Regards Jones

-

Your equation has a form $y'+2xy=\text{e}^x$. The routine way to solve this OE is to use a function called integrating factor. It can be prove that for an OE, $y'+p(x)y=q(x)$, thge integrating factor is $$\mu(x)=\text{e}^{\int p(x)dx}$$ Once, you get this function, as you already did, multiply it to both sides of the OE and it makes the OE complete. For our OE, you considered first the homogenous equation so we have: $$y'+2xy=0$$ The suitable integrating factor is $$\mu(x)=\exp\left(\int 2xdx\right)=\text{e}^{x^2}$$ so we have $\text{e}^{x^2}y'+2x\text{e}^{x^2}y=0$ so $d\left(\text{e}^{x^2}y\right)=0$ and by a simple integration we have $$\text{e}^{x^2}y=K$$ and then $y=K\text{e}^{-x^2}$. This is your first question. Instead of you, I consider the original OE and multiply resulted integrating factor to both of it: $$\text{e}^{x^2}y'+2x\text{e}^{x^2}y=\text{e}^{x^2}\times\text{e}^x=\text{e}^{x^2+x}$$ so we have $$d\left(\text{e}^{x^2}y\right)=\text{e}^{x^2+x}$$ Integrating form both sides gives us: $$\text{e}^{x^2}y=\int \text{e}^{x^2+x} dx$$ which cannot be evaluated in terms of elementary functions.

-
Very nicely done! +1 :-) – amWhy Jan 28 '13 at 16:09
Thank you very much. That explains a lot. – Jonas Jan 29 '13 at 16:19

We want to solve the linear equation:
$2 x y+ \frac{dy}{dx} = e^x$:
Let $\mu(x) = e^{( \int 2 x dx)} = e^{x^2}$.
Multiply both sides by $\mu(x)$:
$2 e^{x^2} x y+e^{x^2} \frac{dy}{dx} = e^{x^2+x}$
Substitute $2 e^{x^2} x = \frac{dy}{dx}e^{x^2}$:
$y \frac{d}{dx}e^{x^2}+e^{x^2} \frac{dy}{dx} = e^{x^2+x}$
Apply the reverse product rule $g \frac{df}{dx}+f \frac{dg}{dx} = \frac{d}{dx}f g$ to the left-hand side:
$\frac{d}{dx}e^{x^2} y = e^{x^2+x}$
Integrate both sides with respect to $x$:
$\int \frac{d}{dx}e^{x^2} y dx = \int e^{x^2+x} dx$
Evaluate the integrals:
$e^{x^2} y = c_1+\sqrt(\pi) \frac{\text{erfi}(x+1/2))}{(2 e^{1/4})}$, where $c_1$ is an arbitrary constant.
Divide both sides by $\mu(x) = e^{x^2}$:
$y(x) = \displaystyle \frac{c_1+\sqrt(\pi) \frac{\text{erfi}(x+1/2))}{(2 e^{1/4}))}}{e^{x^2}}$

Notice that: $x^2 + x = (x+\frac{1}{2})^{2} - \frac{1}{4}$. You can do $u$ substitution on $x+\frac{1}{2}$, and factor out the constant $e^{\frac{-1}{4}}$, and then use the fact that: $$e^{\frac{-1}{4}}\int e^{u^2} dx = e^{\frac{-1}{4}}\frac{1}{2} \sqrt{\pi}\; \text{erfi}(u)+ C$$

For question $2$:
$$\sum_{m=1}^n \frac{n}{(m^2+n^2)} = \\ \frac{1}{2} i \left(\psi^{(0)}(0, 1-i n)-\psi^{(0)}(0, i n+1)-\psi^{(0)}(0, (1-i) n+1)+\psi^{(0)}(0, (1+i) n+1)\right)\\$$ And: $$\lim_{n\to\infty} \frac{1}{2} i \left(\psi^{(0)}(0, 1-i n)-\psi^{(0)}(0, i n+1)-\psi^{(0)}(0, (1-i) n+1)+\psi^{(0)}(0, (1+i) n+1)\right) = \frac{\pi}{4}$$
If you can somehow relate: $$\lim_{n\to\infty} \sum_{i=1}^{n} \frac{n}{i^2+n^2} \text{to} \;\; \sum_{k=0}^{\infty} \frac{{(-1)}^{k}}{2k+1} = \frac{\pi}{4}$$ That could potentially be a better plan of attack.