$$f''+\lambda f = 0, \quad f=f(y), \quad a \leq y \leq b, \quad f(a)=f(b)=0 $$

In this case, I tried

$$f(y)=sin(k_ny), \quad \lambda=k_n^2 $$ $$f(a)=0 \Longrightarrow k_na = n\pi, \quad n=0,1,2,...$$ $$ k_n=\frac{n\pi}{a}, \quad n=0,1,2,... $$

The problem is that I don't know how to apply the second boundary condition here, so I know something in my approach is wrong. The answer is stated below. I can see why this solution works, but I just don't know how to derive it myself. Also I'm wondering if there is a solution that works from $n=0$.

$$ f(y)=sin(k_n(y-a)), \quad k_n=\frac{n\pi}{b-a}, \quad n=1,2,... $$

EDIT: I tried setting $$ f(y) = Acos(k_ny) + Bsin(k_ny) $$ $$ f(a) = Acos(k_na) + Bsin(k_na) = 0 $$ $$ f(b) = Acos(k_nb) + Bsin(k_nb) = 0 $$

But I'm not sure where to go from here. $f(a)$ can be zero if $A=-B, k_na = \pi/4 + n\pi$, but it can also be zero if $A=0, k_na=n\pi$ or $B=0, k_na=\pi/2+n\pi$. Do I have to check the second condition for all these 3 solutions, or is there any way to know which one I should go with?

  • 1
    $\begingroup$ The function you should try is $f(y) = C_1 \cos (k_n y) + C_2 \sin (k_n y)$ $\endgroup$ – JoseSquare Feb 25 at 20:12
  • $\begingroup$ $f_0 (y)=0$ obviously satisfies both the equation and boundary conditions. $\endgroup$ – user Feb 25 at 20:54
  • $\begingroup$ @user but in the answer, $n=0$ isn't defined. so my second question was if there's a way to rewrite the answer so it's defined for $n=0$ aswell. this is not as important as understanding how they reach the answer though, it's 2nd prio $\endgroup$ – armara Feb 26 at 7:47
  • $\begingroup$ @JoseSquare hey thx for the tip, I updated the answer with an EDIT $\endgroup$ – armara Feb 26 at 7:47
  • $\begingroup$ Contrary to what you think, there are no distinct $k_n$ other than $\sqrt\lambda$. $\endgroup$ – Yves Daoust Feb 26 at 8:10

Assuming $\lambda>0$, the general solution is

$$f(y)=c_c\cos(\sqrt\lambda y)+c_s\sin(\sqrt\lambda y).$$

Plugging the boundary conditions,

$$0=c_c\cos(\sqrt\lambda a)+c_s\sin(\sqrt\lambda a), \\0=c_c\cos(\sqrt\lambda b)+c_s\sin(\sqrt\lambda b).$$

The determinant of this homogeneous linear system is



  • if $\sqrt\lambda(b-a)$ is not a multiple of $\pi$, only the trivial solution $f=0$ is possible;

  • if $\sqrt\lambda(b-a)$ is a multiple of $\pi$, the solutions are

$$c\sin(\sqrt\lambda(x-a))$$ where $c$ is free.

  • $\begingroup$ this was an approach i hadn't thought about, need to read a bit more about how determinants can be used to solve system of equations. thanks for bringing this to my attention, i gave you +1! $\endgroup$ – armara Feb 26 at 8:16
  • $\begingroup$ @armara: you'd better accept this answer. It does give the complete solution. [I never ask such things, but here it's too blatant.] You seem to be stuck on the idea that there are several modes, which is false. $\endgroup$ – Yves Daoust Feb 26 at 8:19
  • $\begingroup$ sure I can do that, you obviously know this better than me. however, i'm personally going to use the other answer for now since I don't quite understand this one. i'll be studying this answer tho, seems like it's good :) if you have any pointers on where i should read to understand these concepts better, i would gladly go there $\endgroup$ – armara Feb 26 at 8:26
  • $\begingroup$ @armara: I can't believe that you don't know the resolution of a $2\times2$ system. You are just disconcerted by the trigonometric functions. $\endgroup$ – Yves Daoust Feb 26 at 8:29

Hint: Solve the related problem

$$ f''(x) + \lambda f(x) = 0, \quad 0 \le x \le 1, \quad f(0)=f(1)=0 $$

Then make the coordinate transform $y = a + (b-a)x $

Edit: You can think about the transform organically. The general solution is

$$ f(y) = A\cos(\sqrt{\lambda}y) + B\sin(\sqrt{\lambda}y) \tag{1} $$

This would be very convenient if one of the B.C.s was at $x=0$ since you have $f(0) = A$ and $f'(0)=\sqrt{\lambda}B$. Since this is not the case, you can try to see what would happen if the solution was shifted to $x=a$ instead

$$ f(y) = \widetilde{A}\cos(\sqrt{\lambda}(y-a)) + \widetilde{B}\sin(\sqrt{\lambda}(y-a)) \tag{2} $$

This is also a solution of the ODE since the operation $f''$ is shift-invariant, and the shifted sinusoids are still a linear combination of the original $\sin$ and $\cos$ functions.

Using $(2)$ as the solution form gives $\widetilde{A} = 0$ and $\sqrt{\lambda} = \dfrac{n\pi}{b-a}$.

Edit 2: I will expand on Yves' answer further to show how you can arrive at the same answer

Using $(1)$ as the solution form, we need to solve

\begin{align} A\cos(\sqrt{\lambda}a) + B\sin(\sqrt{\lambda}a) &= 0 \\ A\cos(\sqrt{\lambda}b) + B\sin(\sqrt{\lambda}b) &= 0 \end{align}

We'll get a non-trivial solution if the determinant of this system is $0$. Another way to understand this without using the determinant is to solve the system normally. Find $B$ in terms of $A$ in the second equation and plug it into the first, you get

$$ A\cos(\sqrt{\lambda}a) - A\frac{\cos(\sqrt{\lambda}b)}{\sin(\sqrt{\lambda}b)}\sin(\sqrt{\lambda}a) = 0 $$

$$ \implies A\big[\cos(\sqrt{\lambda}a)\sin(\sqrt{\lambda}b) - \cos(\sqrt{\lambda}b)\sin(\sqrt{\lambda}a)\big] = A\sin(\sqrt{\lambda}(b-a)) = 0 $$

We can't have $A=0$, so we require

$$ \sin\sqrt{\lambda}(b-a) = 0 \implies \sqrt{\lambda}(b-a) = n\pi $$

where $n=1,2,3,\dots$, $n$ can't be $0$ here since it would also give a trivial solution (you should've excluded the cases $\lambda=0$ and $\lambda < 0$ earlier on)

Now, $A$ and $B$ form a family of solutions satisfying

$$ \frac{A}{B} = -\frac{\sin(\sqrt{\lambda}a)}{\cos(\sqrt{\lambda}a)} = -\frac{\sin(\sqrt{\lambda}b)}{\cos(\sqrt{\lambda}b)} $$

we can arbitrarily set $A = -c\sin(\sqrt{\lambda}a)$, $B=c\cos(\sqrt{\lambda}a)$ (which is fine since we know the final solution still has one free constant). Thus

$$ f(y) = -c\sin(\sqrt{\lambda}a)\cos(\sqrt{\lambda}y) + c\cos(\sqrt{\lambda}a)\sin(\sqrt{\lambda}y) = c\sin(\sqrt{\lambda}(y-a)) $$

  • $\begingroup$ hey and thanks for the tip, i'll definitely remember this approach. however, i'd like to understand the regular way aswell (setting $f(x)=Acos..+Bsin..$) since I won't always think of a good transformation :) $\endgroup$ – armara Feb 26 at 7:49
  • $\begingroup$ You seem to be very focused on the normalization of the variable. This is neither necessary, nor really helpful. It doesn't change the nature of the resolution. $\endgroup$ – Yves Daoust Feb 26 at 8:15
  • $\begingroup$ (after your edit): this makes so much sense... you know that you want either $A=0$ or $B=0$, so you shift both your sine and your cosine to make that happen. and then it's trivial. big thanks, this helped a lot! $\endgroup$ – armara Feb 26 at 8:15
  • $\begingroup$ @YvesDaoust You're right. It was mostly the shifting I wanted to focus on. The scaling just makes it look "nice" $\endgroup$ – Dylan Feb 26 at 8:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.