$\frac{dU}{dx^2} + k^2U = f$ with $U(0)=U(\pi)=0$ where $K \notin \mathbb{Z}$
I can't see why:
the eigenfunctions are $\phi_n(x) = \sqrt{\frac{2}{\pi}}sin(nx)$ and eigenvalues
$\lambda_n = k^2 - n^2$ for $n=1, 2 ...$
Solving the homogeonous equation and using $U(0)=0$ gives $U= Asin(kx)$ but since $K \notin \mathbb{Z}$ im not sure how to continue?
You are solving the eigenvalue problem $$ U''+k^2U = \lambda U \quad\iff\quad U''+(k^2-\lambda)U = 0 $$ with the boundary conditions $U(0)=U(\pi) = 0$.
Assuming that $\lambda < k^2$, the general solution of the equation above is given by $$ U(x) = A\cos(x\sqrt{k^2-\lambda}) + B\sin(x\sqrt{k^2-\lambda}). $$ From $U(0)=0$, we see that $A=0$, so $$ U(x) = B\sin(x\sqrt{k^2-\lambda}) .$$ From $U(\pi)=0$, we get $$ 0 = U(\pi) = B\sin(\pi\sqrt{k^2-\lambda}). $$ If $\lambda$ is to be an eigenvalue, we must require that $B\not=0$ (since otherwise $U\equiv0$ cannot be an eigenvector). This forces $$ \sin(\pi\sqrt{k^2-\lambda})=0 \quad\iff\quad \sqrt{k^2-\lambda}\; \text{ is an integer}. $$ Can you proceed?