Confusion about orthogonality for eigenfunctions of separable PDE, where eigenvalues satisfy $\tan \lambda = \lambda$ I am having a go at solving the following simple problem:
\begin{equation}
\begin{array}{rllc}
\dfrac{\partial^{2}T}{\partial x^{2}}+\dfrac{\partial^{2}T}{\partial y^{2}} & =0 & \text{in }[0,1]^{2} & {\rm \text{(i)}}\\
T & =0 & \text{on }y=0, & \text{(ii)}\\
T & =f(x) & \text{on }y=1, & \text{(iii)}\\
\dfrac{\partial T}{\partial x} & =0 & \text{on }x=0, & \text{(iv)}\\
-\dfrac{\partial T}{\partial x} & =\dfrac{\partial^{2}T}{\partial x^{2}} & \text{on }x=1. & \text{(v)}
\end{array}\label{eq:thinWall-approx-heatProblemFluid-effectiveBCs}
\end{equation}
Using separation of variables, such that $T(x,y)={\cal X}(x){\cal Y}(y)$, one can use boundary condition (v) to show that the eigenfunctions are $${\cal X}(x)=\cos \lambda_n x$$
where the eigenvalues $\lambda_n$ satisfy
$$\tan \lambda_n = \lambda_n$$
I am aware that, starting with Laplace's equation, one can get $\cal{X}''(x)/\cal{X}(x) = -\lambda^2$, which is expressible in Sturm-Liouville form as
$$(p(x)\cal{X}'(x))'+(q(x)+\mu r(x))\cal{X}(x) = 0$$
where $p(x) = 1$, $q(x)$ = 0, $\mu = \lambda_n ^2$ and $r(x) = 1$, and that the weight function in the orthogonality of eigenfunctions is given by $r(x)$. The set of values $\{\lambda_n\}$ satisfying $\tan\lambda = \lambda$ is increasing, countably infinite, and $\lambda_n \sim \left(n+\tfrac{1}{2} \right)\pi$ as $n\to\infty$. Furthermore $\lim_{n\to\infty}\lambda_n = \infty$, so as far as I can tell this is a standard Sturm-Liouville problem for which orthogonality of the eigenfunctions should hold on the interval $[0,1]$ (with respect to the weight function $r(x) \equiv 1.$)
I am therefore confused about why  I am getting something different to $\text{constant}\times\delta_{mn}$ for the integral $$\int_{0}^{1}\cos \lambda_m x \cos \lambda_n x {\rm d}x=\begin{cases}
\dfrac{\lambda_{m}\sin\lambda_{m}\cos\lambda_{n}-\lambda_{n}\cos\lambda_{m}\sin\lambda_{n}}{\left(\lambda_{m}-\lambda_{n}\right)\left(\lambda_{m}+\lambda_{n}\right)}, & m\neq n,\\
\dfrac{2\lambda_{n}+\sin2\lambda_{n}}{4\lambda_{n}}, & m=n.
\end{cases}$$
Obviously this does give $\delta_{mn}/2$ in the case where $\lambda_n = \left(n+\tfrac{1}{2} \right)\pi$, since $\cos\left(n+\tfrac{1}{2} \right)\pi = 0$ for all $n\in\mathbb {Z}$, and I can make headway by using $\tan \lambda_n = \lambda_n$ to show that
$$\frac{\lambda_{m}\sin\lambda_{m}\cos\lambda_{n}-\lambda_{n}\cos\lambda_{m}\sin\lambda_{n}}{\left(\lambda_{m}-\lambda_{n}\right)\left(\lambda_{m}+\lambda_{n}\right)} = \cos\lambda_{n}\cos\lambda_{m}. $$
but if I make a small perturbation around these roots, say, $\varepsilon_n = \lambda_n - \left(n+\tfrac{1}{2} \right)\pi$, I can show that
$$ \int_{0}^{1}\cos\lambda_{n}x\cos\lambda_{m}x{\rm d} x=\begin{cases}
\dfrac{1}{2}(-1)^{m+n}\varepsilon_{m}\varepsilon_{n}+{\cal O}(\varepsilon_{m}\varepsilon_{n}^{2}), & m\neq n,\\
\dfrac{1}{2}+\dfrac{\varepsilon_{n}^{2}}{2}+{\cal O}(\varepsilon_{n}^{4}) & m=n.
\end{cases}.$$
I can clearly see that the result will converge to $\delta_{mn}/2$ as $m,n\to\infty$ so that $\varepsilon_m,\varepsilon_n \to 0$, but I am still confused as to why the integral is not giving exactly $\delta_{mn}/2$ given that it seems to resemble a standard Sturm-Liouville problem. I am therefore in a situation where I cannot uniquely determine the coefficients in the usual series expansion.
My questions are as follows:

*

*Does the fact that my inner product does not equal $\delta_{mn}/2$ exactly mean that I have used the wrong weight function? If so, how can I find a suitable one to use?

*Is there another subtlety in this problem that I have missed?
 A: First, it is more likely that the correct form of the last boundary condition problem is $T+T_x=c$, which you homogenize (i.e. set $c=0$) for purposes of determining the associated eigenfunctions. This form is needed to check self-adjointness, which is done as follows:
$$\int_0^1 u v'' dx = u(1) v'(1) - u(0) v'(0) - \int_0^1 u' v' dx \\= u(1) v'(1) - u(0) v'(0) - u'(1) v(1) + u'(0) v(0) + \int_0^1 u'' v dx$$
Now the terms at $x=0$ are just zero while the terms at $x=1$ cancel because $u(1) v'(1) - u'(1) v(1)=-u(1) v(1) + u(1) v(1)=0$.
To see why this is correct physically you have to notice that actually $T_x(1)$ is the current of heat into the domain, so that should be like $c-T$. The second derivative in the heat equation comes from what is left over after the current through the left side of a small region is cancelled by the current through the right side.
Second, the resulting problem has a nontrivial solution if $\left. \frac{\partial }{\partial x} \cos(\lambda x) \right |_{x=1} + \cos(\lambda)=0$ i.e. $-\lambda \sin(\lambda)+\cos(\lambda)=0$ i.e. $\lambda=\cot(\lambda)$ not $\lambda=\tan(\lambda)$. In this case in the numerator of your expression for $m \neq n$, you have
$$\cot(\lambda_m) \sin(\lambda_m) \cos(\lambda_n) - \cot(\lambda_n) \sin(\lambda_n) \cos(\lambda_m) \\ 
=\cos(\lambda_m) \cos(\lambda_n) - \cos(\lambda_n) \cos(\lambda_m) \\
=0.$$
Now for the modeling question. Consider 1D for simplicity. Suppose you have a Dirichlet condition at $0$ where $T=T_1$, a Dirichlet condition at $1+h$ where $T=T_2$, and different conductivities $K_1,K_2$ in $(0,1)$ and $(1,1+h)$. This amounts to
$$T''=0 \quad x \neq 1 \\
T(0)=T_1 \\
T(1+h)=T_2.$$
Because there is nowhere outside the system for energy to go, in order to have conservation of energy we must match fluxes at the interface:
$$K_1 T'(1^-)=K_2 T'(1^+).$$
The question then is what actually is $T'(1^-)$? You need an additional boundary condition to say. The conventional answer is to use a Robin condition so that the flux through the interface is proportional to the jump in the temperature. Thus you set it up with
$$K_1 T'(1^-)=K_1 a_1 \\
= K_3(T(1^+)-T(1^-)) \\
= K_3(-a_1-a_2 h + T_2 - T_1) \\
= K_2 a_2.$$
In general this conductivity $K_3$ is not the same as either $K_1$ or $K_2$.
So you read off the equation for $a_1$:
$$K_1 a_1=K_3 \left ( -a_1 - \frac{K_1}{K_2} a_1 h + T_2 - T_1 \right )$$
from which you recover $a_1=\frac{T_2-T_1}{1+\frac{K_1}{K_3}+\frac{K_1 h}{K_2}}$.
