Slightly different results to an ODE system - hand calculation vs Mathematica This has been driving me mad for the last few days. I have a a pair of ODEs:
$$\frac{d^2 M_N}{d x^2}=\lambda_{N}^2 M_N$$
$$\frac{d^2 M_{N-1}}{d x^2}=\lambda_{N-1}^2 M_{N-1}-\frac{f}{d_{N-1}}M_N$$
With BCs
$$M_N(1)=M_{N-1}(1)=0,\ \frac{d M_{N}}{d x}(0)=h,\ \frac{d M_{N-1}}{d x}(0)=0$$
The solution to $M_N$ is:
$$M_N(x)=\frac{h}{\lambda_N}\text{sech}(\lambda_N)\sinh(\lambda_N(x-1))$$
No surprises there.
The trouble comes when I solve $M_{N-1}$. I get:
$$M_{N-1}=\frac{fh}{d_{N-1}\lambda_{N}^2}\left(\frac{1}{\lambda_N}\text{sech}(\lambda_N)\sinh(\lambda_N(x-1))-\frac{1}{\lambda_{N-1}}\text{sech}(\lambda_{N-1})\sinh(\lambda_{N-1}(x-1))\right)$$
However, Mathematica gets
$$M_{N-1}=\frac{fh}{d_{N-1}(\lambda_{N-1}^2-\lambda_{N}^2)}\left(\frac{1}{\lambda_N}\text{sech}(\lambda_N)\sinh(\lambda_N(x-1))-\frac{1}{\lambda_{N-1}}\text{sech}(\lambda_{N-1})\sinh(\lambda_{N-1}(x-1))\right)$$
Now, I can say for certain that $|\lambda_N| \ne |\lambda_{N-1}|$. I realise Mathematica doesn't know this, and I suspect that could have something to do with this. But I simply can't find a way to come up with the same result by hand.
I know this is a selfish question, but can someone step through the process and show me how to come up with Mathematica's answer please!
 A: The general solution to the ODE

$$
u''(x) = a^2\,u(x)
$$
  for $a \in \mathbb{R}$ is
  $$
u(x) = A\sinh(ax) + B\cosh(ax)
$$

The BC

$$u(1) = 0$$

then requires
$$
B = -A\tanh(a)
$$
so
$$
u(x) = A \left[\, \sinh(ax) - \tanh(a)\cosh(ax) \,\right]
     = A\operatorname{sech}(a) \sinh[\,a\,(x-1)\,]
$$
and
$$
u'(x) = Aa\operatorname{sech}(a) \cosh[\,a\,(x-1)\,]
$$
The BC

$$u'(0) = h$$

then implies
$$
h = Aa\operatorname{sech}(a) \cosh(a) = Aa
$$
so $A = h/a$ and the solution is:

$$
u(x) = \frac{h}{a}\,\operatorname{sech}(a) \sinh[\,a\,(x-1)\,]
$$

The solution to the non-homogeneous ODE
$$
v''(x) = b^2\,v(x) + c\,u(x)
$$
where $b,c \in \mathbb{R}$, subjected to the BCs $v(1) = v'(0) = 0$, is the sum of the general solution of its homogeneous counterpart and a particular solution. The general solution of the homogeneous ODE $v''(x) = b^2\,v(x)$ is, as
before,
$$
v(x) = C\sinh(bx) + D\cosh(bx)
$$
As for a particular solution of $v''(x) = b^2\,v(x) + c\,u(x)$, let's try
$$
v(x) = E\,u(x)
$$
where $E$ is a constant. Then,
$$
v''(x) = b^2\,v(x) + c\,u(x)
\implies
E\,u''(x) = b^2\,E\,u(x) + c\,u(x)
$$
But $u''(x) = a^2\,u(x)$ and we find
$$
E = \frac{c}{a^2 - b^2}
$$
Thus, the general solution of $v''(x) = b^2\,v(x) + c\,u(x)$ is
$$
v(x) = C\sinh(bx) + D\cosh(bx) + \frac{c}{a^2 - b^2}\,u(x)
$$
assuming $a \ne b$. Applying the BC $v(1) = 0$, and using $u(1) = 0$, it follows
$$
D = -C\tanh(b)
$$
so
$$
v(x) = C\operatorname{sech}(b) \sinh[\,b\,(x-1)\,] + \frac{c}{a^2 - b^2}\,u(x)
$$
and
$$
v'(x) = Cb\operatorname{sech}(b) \cosh[\,b\,(x-1)\,] + \frac{c}{a^2 - b^2}\,u'(x)
$$
The BCs $v'(0) = 0$ and $u'(0) = h$ then imply
$$
0 = Cb + \frac{ch}{a^2 - b^2}
$$
from which
$$
C = - \frac{ch}{b}\frac{1}{a^2 - b^2} = \frac{ch}{b}\frac{1}{b^2 - a^2}
$$
Therefore,
$$
v(x) = \frac{ch}{b}\frac{1}{b^2 - a^2}\,\operatorname{sech}(b) \sinh[\,b\,(x-1)\,] + \frac{c}{a^2 - b^2}\,u(x)
$$
which can be rearranged as

$$
v(x) = -\frac{ch}{b^2 - a^2}\,
\left\{\,
\frac{1}{a}\,\operatorname{sech}(a) \sinh[\,a\,(x-1)\,] -
\frac{1}{b}\,\operatorname{sech}(b) \sinh[\,b\,(x-1)\,]
\,\right\}
$$
  where the first term comes from $u(x)$.

The identifications
$$
u \quad\leftrightarrow\quad M_N
$$
$$
a \quad\leftrightarrow\quad \lambda_N
$$
$$
v \quad\leftrightarrow\quad M_{N-1}
$$
$$
b \quad\leftrightarrow\quad \lambda_{N-1}
$$
$$
c \quad\leftrightarrow\quad -\frac{f}{d_{N-1}}
$$
then lead to the result obtained by Mathematica.
