Deriving the deflection force equation for a beam that is fixed on both ends

I want to calculate the force-displacement equation for a beam that is fixed at both ends. I think I should use the superposition principle but I am not very sure how to get started.

I know that for, say, a beam with one fixed-end and applied load $P$, then:

\begin{align} EI \frac{d^2v}{dx^2}&=\mu_0\\ EI \frac{dv}{dx}&=\mu_0x+C_1\\ EI v(x)&=\mu_0x^2/2+C_1x+C_2 \end{align}

How can I solve this for a fixed beam on both ends?

Consider a horizontal beam of length $L$ along the x-axis with vertical displacement $v$. Also consider that is has an applied load $P$ at $\frac{L}{2}$:

$$\dfrac{d^2v(x)}{dx^2} = \dfrac{M(x)}{EI}$$

Start with finding the moment in terms of x. You should know that the moment reaction on the left end is $-PL/8$ and the force reaction is $P/2$ so for $0 \le x \le L/2$ the moment function is: $$M(x) - \dfrac{PL}{8} + \dfrac{P}{2}x = 0$$ $$M(x) = \dfrac{PL}{8} - \dfrac{P}{2}x$$

Integrate once: $$\dfrac{d^2v(x)}{dx^2} = \dfrac{PL}{8EI} - \dfrac{P}{2EI}x$$ $$\dfrac{dv(x)}{dx} = \theta(x) = \dfrac{PL}{8EI}x - \dfrac{P}{4EI}x^2 + C_1$$

We know that the slope, $\theta(x)$, at either end is zero because the ends are fixed which gives us the condition $\theta(0)=0$:

$$\theta(0) = 0 + 0 + C_1$$ $$\therefore C_1=0$$ $$\therefore \theta(x) = \dfrac{PL}{8EI}x - \dfrac{P}{4EI}x^2$$

Integrate again: $$v(x) = \dfrac{PL}{16EI}x^2 - \dfrac{P}{12EI}x^3 + C_2$$

We know the displacement at either end is zero so that gives the condition $v(0)=0$: $$v(0) = 0 + 0 + C_2$$ $$\therefore C_2 = 0$$ $$\therefore v(x) = \dfrac{PL}{16EI}x^2 - \dfrac{P}{12EI}x^3$$ $$= \dfrac{Px^2}{48EI}(3L-4x)$$

This equation only applies between $0 \le x \le L/2$ but the example is symmetric.