# [SOLVED]Inhomogeneous DE via expansion

#### dwsmith

##### Well-known member
Solve inhomogeneous differential equation
$y'' + k^2y = \phi(x)$
with homogeneous boundary conditions $$y(\ell) = 0$$ and $$y(0) = 0$$ by expanding $$y(x)$$ and $$\phi(x)$$
\begin{align*}
y(x) &= \sum_na_nu_n(x)\\
\phi(x) &= \sum_nb_nu_n(x)
\end{align*}
in the eigenfunctions of $$L = \frac{d^2}{dx^2}$$ where $$Lu_n(x) = -k^2u_n(x)$$ and $$u_n$$ satisfies the homogeneous boundary conditions.

How am I supposed to use the definitions of $$y(x)$$ and $$\phi(x)$$ to solve this problem?

#### Ackbach

##### Indicium Physicus
Staff member
Re: inhomogeneous DE via expansion

I would do this in the following steps:

1. First, find the eigenfunctions of the indicated operator.

2. Plug those eigenfunctions into the definitions of $y$ and $\phi$.

3. Plug those definitions into the DE and see what you can find out.

#### dwsmith

##### Well-known member
Re: inhomogeneous DE via expansion

I would do this in the following steps:

1. First, find the eigenfunctions of the indicated operator.

2. Plug those eigenfunctions into the definitions of $y$ and $\phi$.

3. Plug those definitions into the DE and see what you can find out.

Let $$G(x, x') = \delta(x - x')$$ is a solution with B.C. $$G(0, x') = G(\ell, x') = 0$$.
$u(x) = u_n(x) + \int_0^{\ell}G(x,x')\phi(x')dx'$
where $$Lu_n(x) = \frac{d^2}{dx^2}u_n + k^2u_n = 0$$.
Now for the steady state, we have
$\left(\frac{d^2}{dx^2} + k^2\right)u_n = 0$
So $$u_n(x) \sim \left\{\cos(kx), \sin(kx)\right\}$$.
From the B.C., $$u_n(x)\sim B_n\sin\left(\frac{\pi n}{\ell}x\right)$$.
\begin{align}
G(x, x') &= \sum_{n = 1}^{\infty}B_n\sin\left(\frac{\pi n}{\ell}x\right)\\
y(x) &= \sum_{n = 1}^{\infty} a_n\sin\left(\frac{\pi n}{\ell}x\right)\\
\phi(x) &= \sum_{n = 1}^{\infty} b_n\sin\left(\frac{\pi n}{\ell}x\right)
\end{align}
Should they all be the same? I know how to find the coefficients for $$G(x, x')$$ but what about for $$y(x)$$ and $$\phi(x)$$?

#### Ackbach

##### Indicium Physicus
Staff member
Re: inhomogeneous DE via expansion

So now, plugging your stuff into the DE, we have
$$-\sum_{n = 1}^{\infty} a_n \left( \frac{\pi n}{\ell}\right)^{2}\sin\left(\frac{\pi n}{\ell}x\right)+k^{2}\sum_{n = 1}^{\infty} a_n \sin\left(\frac{\pi n}{\ell}x\right)=\sum_{n = 1}^{\infty} b_n\sin\left(\frac{\pi n}{\ell}x\right).$$
Presumably the $b_{n}$'s are known, and the $a_{n}$'s are not. Can you think of a way to determine the $a_{n}$'s?

#### dwsmith

##### Well-known member
Re: inhomogeneous DE via expansion

So now, plugging your stuff into the DE, we have
$$-\sum_{n = 1}^{\infty} a_n \left( \frac{\pi n}{\ell}\right)^{2}\sin\left(\frac{\pi n}{\ell}x\right)+k^{2}\sum_{n = 1}^{\infty} a_n \sin\left(\frac{\pi n}{\ell}x\right)=\sum_{n = 1}^{\infty} b_n\sin\left(\frac{\pi n}{\ell}x\right).$$
Presumably the $b_{n}$'s are known, and the $a_{n}$'s are not. Can you think of a way to determine the $a_{n}$'s?
I was reading that the superposition of eigenfunctions: Green's functions and it says that
$Ly_n(x) = \lambda_n\rho(x)y_n(x)$
where $$\rho(x)$$ is a weighting function. So does that mean I can write $$b_n = \frac{2}{\ell}$$?
Also, would it follow by the completeness of Hermitian eigenfunctions?
$a_n = \frac{b_n}{k^2 - k_n^2}$

If we do that, we get
\begin{align}
\sum_{n = 1}^{\infty}a_n[k^2 - k_n^2]\sin(k_nx) &= \frac{2}{\ell}\sum_{n = 1}^{\infty}\sin(k_nx)\\
a_n[k^2 - k_n^2]\int_0^{\ell} \sin^2(k_nx)dx &= \frac{2}{\ell}\int_0^{\ell} \sin^2(k_nx)dx\\
a_n &= \frac{2}{\ell(k^2 - k_n^2)}
\end{align}
If that is $$a_n$$ and $$b_n$$ is $$2/\ell$$, $$y(x)$$ is a solution with that given $$\phi(x)$$.

Last edited:

#### Ackbach

##### Indicium Physicus
Staff member
Re: inhomogeneous DE via expansion

I think Green's functions are overkill for this problem. Just use Fourier analysis. I get that
$$b_{p}= \frac{2}{\ell} \int_{0}^{ \ell} \sin \left( \frac{\pi p x}{ \ell} \right) \phi(x) \, dx,\quad \text{and} \quad a_{p}= \left( \frac{ \ell^{2}}{k^{2} \ell^{2}- \pi^{2} p^{2}} \right) \, b_{p}.$$

#### dwsmith

##### Well-known member
Re: inhomogeneous DE via expansion

I think Green's functions are overkill for this problem. Just use Fourier analysis. I get that
$$b_{p}= \frac{2}{\ell} \int_{0}^{ \ell} \sin \left( \frac{\pi p x}{ \ell} \right) \phi(x) \, dx,\quad \text{and} \quad a_{p}= \left( \frac{ \ell^{2}}{k^{2} \ell^{2}- \pi^{2} p^{2}} \right) \, b_{p}.$$
I think I have to use Green's function since I need an exact solution but I have gotten that.

However, if $$k = k_m$$, why would $$u_m(x)$$ have to be orthogonal to $$\phi(x)$$. For the case $$k_m = k_n$$, the LHS is always zero.
$\sum_na_n[k_m^2 - k_n^2]\sin(k_nx) = \frac{2}{\ell}\sum_n\sin(k_nx)$
Therefore, in order $$\int_0^{\ell}u_m(x)\phi(x)dx = 0$$, they must be orthgonal. When $$k_m\neq k_n$$, I don't see why that would be the case.

#### Ackbach

##### Indicium Physicus
Staff member
Re: inhomogeneous DE via expansion

I think I have to use Green's function since I need an exact solution but I have gotten that.

However, if $$k = k_m$$, why would $$u_m(x)$$ have to be orthogonal to $$\phi(x)$$. For the case $$k_m = k_n$$, the LHS is always zero.
$\sum_na_n[k_m^2 - k_n^2]\sin(k_nx) = \frac{2}{\ell}\sum_n\sin(k_nx)$
Therefore, in order $$\int_0^{\ell}u_m(x)\phi(x)dx = 0$$, they must be orthgonal. When $$k_m\neq k_n$$, I don't see why that would be the case.
Hmm. Well, here's my analysis. First, we write $\phi$ in terms of the eigenfunctions:
\begin{align*}
\phi(x)&= \sum_{n=1}^{ \infty}b_{n} \sin( \pi n x / \ell) \\
\int_{0}^{ \ell} \sin( \pi m x / \ell) \, \phi(x) \, dx&= \sum_{n=1}^{ \infty} \left[b_{n} \int_{0}^{ \ell} \sin( \pi n x / \ell) \sin( \pi m x / \ell) \, dx\right] \\
\int_{0}^{ \ell} \sin( \pi m x / \ell) \, \phi(x) \, dx&= \sum_{n=1}^{ \infty} \left[b_{n} \delta_{nm} (\ell/2) \right] = b_{m} (\ell/2).
\end{align*}
Therefore,
$$b_{m}= \frac{2}{ \ell}\int_{0}^{ \ell} \sin( \pi m x / \ell) \, \phi(x) \, dx.$$
Now, from the equation I wrote down in the previous post, we have that
$$\sum_{j=1}^{ \infty} \left[ (k^{2}-( \pi j / \ell)^{2}) \, a_{j} \sin( \pi j x / \ell) \right]= \sum_{p=1}^{ \infty} b_{p} \sin( \pi p x / \ell).$$
Multiplying through by $\sin( \pi m x / \ell)$ and integrating from $0$ to $\ell$ yields
$$\sum_{j=1}^{ \infty} \left[ (k^{2}- \pi^{2} j^{2}/ \ell^{2}) \, a_{j} \, \delta_{mj} \, ( \ell/2) \right]= \sum_{p=1}^{ \infty} b_{p} \delta_{mp}( \ell/2),$$
and collapsing both sums due to the Kronecker Deltas yields
$$a_{m}= \left( \frac{ \ell^{2}}{k^{2} \ell^{2}- \pi^{2} m^{2}} \right) \, b_{m}.$$
Therefore, the final solution in all its glory is
\begin{align*}
y(x)&= \sum_{m=1}^{ \infty} \left[
\frac{ \ell^{2}}{k^{2} \ell^{2}- \pi^{2}m^{2}} \cdot \frac{2}{ \ell} \cdot \int_{0}^{ \ell} \sin( \pi m \xi/ \ell) \, \phi( \xi) \, d \xi \cdot \sin( \pi m x/ \ell) \right] \\
&=\sum_{m=1}^{ \infty} \left[
\frac{ 2 \ell}{k^{2} \ell^{2}- \pi^{2}m^{2}} \cdot \int_{0}^{ \ell} \sin( \pi m \xi/ \ell) \, \phi( \xi) \, d \xi \cdot \sin( \pi m x/ \ell) \right].
\end{align*}
It's an exact solution (assuming I've done everything correctly), with no Green's functions required.

If you want to use Green's functions, go ahead. Alas, I know only the very basics of the theory, so I cannot follow you there. But this method of solution is fairly straight-forward, involving nothing more complicated than Fourier analysis.