Solving a differential equation with initial conditions only on the function I have the initial value problem $\left\{\begin{gather}E_nf_n(x)+f_n''(x) = 0\\
f_n(-a)=f_n(a)=0 \end{gather}\right.$.
Solving it using Laplace transform I get $$f_n(x) = f_0\cos(\sqrt{E_n}x)+\frac{f_0'}{\sqrt{E_n}}\sin(\sqrt{E_n}x)$$
In my attempt to solve for $f_0$ and $f_0'$ I did the following
$\left\{\begin{gathered}f_n(a) = f_0\cos(\sqrt{E_n}a)+\frac{f_0'}{\sqrt{E_n}}\sin(\sqrt{E_n}x)=0\\
f_n(-a) = f_0\cos(\sqrt{E_n}a)-\frac{f_0'}{\sqrt{E_n}}\sin(\sqrt{E_n}x)=0\end{gathered}\right.$
Adding and substracting both equations, assuming $f_0 \neq 0$ and $f'_0 \neq 0$, I get
$\left\{\begin{gathered}\cos(\sqrt{E_n}a)=0\\
\sin(\sqrt{E_n}a)=0\end{gathered}\right.$
Here I'm a bit lost and dont' know how to proceed further. If I list all the possible solutions for $\cos(\sqrt{E_n}a)=0$ and $\sin(\sqrt{E_n}a)=0$, I can't find $E_n$ such that $\cos(\sqrt{E_n}a)=0$ and $\sin(\sqrt{E_n}a)=0$, the intersection of both sets is the empty set.
How could I proceed into finding a solution for the IVP? I tried to solve it using Mathematica but it gives that $\cos(\sqrt{E_n}a)=0$ or $\sin(\sqrt{E_n}a)=0$, in which case I get a set of values for $E_n$, mainly $E_n = \frac{\pi^2n^2}{4a^2}$. How could I get to this solution with the equations I showed above?
Also, How could I find $f_0$ and $f_0'$? or how could I find a relation betweeen $f_0$ and $f_0'$?


This is a eigenvalue problem, so we are looking for $E_n$ such that the differential equation has nontrivial solutions.
Your choice that both $f_0\neq0$ and $f_0'\neq0$ (at the same time!) is too restrictive. You get solutions by either

*

*$f_0=0$ and $\sin (\sqrt{E_n^s}a)=0 \Rightarrow f_n^s=c\sin(\sqrt{E_n^s}x)$ with $E_n^s=(\tfrac{n\pi}{a})^2$ or

*$f_0'=0$ and $\cos (\sqrt{E_n^c}a)=0 \Rightarrow f_n^c=c\cos(\sqrt{E_n^c}x)$ with $E_n^c=\left(\tfrac{(n+1/2)\pi}{a}\right)^2$.

This concludes the problem. However we can rewrite both families of solutions solutions into one single family of solutions if we rewrite the cosine functions as shifted sine functions:
$$
\cos(\sqrt{E_n^c}x)=\cos(\tfrac{(n+1/2)\pi}{a}x)=(-1)^{n}\sin(\tfrac{(n+1/2)\pi}{a}x+(n+1/2)\pi)=(-1)^{n}\sin(\tfrac{(2n+1)\pi(x+a)}{2a})
$$
If we now define
$$E_k=\begin{cases}E_{k/2}^s&k \mbox{ even}\\E_{(k+1)/2}^c&k \mbox{ uneven}\end{cases}$$
and similarly with the functions, we get the result from mathematica.
A potentially easier approach is to consider the shifted problem to begin with: $g(x+a):=f(x)$ which yields the problem:
$$
E_ng_n(x)+g''_n(x)=0\\
g_n(0)=g_n(2a)=0
$$
this yields only sine functions as nontrivial solutions directly.
