Working through Introducing Mechanics, by Brian Jefferson and Tony Beadsworth. Question 5 of Exercise 5D has me a bit stumped. For some reason I get $\sqrt{3}$ times the result I want.
$\mathbf{The\;Question:}$
A smooth fixed plane is inclined at $30^{\circ}$ to the horizontal. A wedge of mass M and angle $30^{\circ}$ is held on the surface so that its upper face is horizontal, and a particle of mass $m$ rests on the face. The system is released from rest. Show that the resultant acceleration of the particle is $$\frac{(M+m)g}{4M+m}$$
Please find a picture of my working attached below, along with a bonus creepy silhouette of me pondering where it all went wrong.
$a$ is the acceleration of the wedge down the slope. $f$ is the acceleration of the particle on top of the wedge, $R$ (upwards) is the normal reaction of the wedge on the particle and $R$ downards is the normal reaction of the particle on the wedge. Using trigonometry, splitting forces into components and Newton's second law $F = ma$, I got the following 3 equations: $$Mg \sin(30^{\circ}) + R \sin(30^{\circ}) = Ma$$ $$mg \sin(30^{\circ}) - R \sin(30^{\circ}) = m(f \cos(30^{\circ}) + a)$$ $$R \cos(30^{\circ}) - mg \cos(30^{\circ}) = mf\sin(30^{\circ})$$
Solving for $f$ I get $$f=\frac{-\sqrt{3}(M+m)g}{4M+m}$$
The negative (if correct) just means I got the direction of acceleration wrong in my diagram. But that $\sqrt{3}$ definitely shouldn't be there. Triple checked, and couldn't find anything wrong, which means there is a problem with the equations I used.
Any help is greatly appreciated!

Considering the dynamics for each mass and also that the wedge is smooth
$$ m\vec \alpha_m = m\vec g + \vec V\\ M\vec\alpha_M = M\vec g-\vec V + \vec N\\ $$
with
$$ \vec\alpha_m = (0,a_m)\\ \vec g = (0,-g)\\ \vec V = (0, v)\\ \vec\alpha_M = (a_x,a_y)\\ \vec N = n(-\sin\theta,\cos\theta) $$
now solving for $n,a_x,a_y,a_m,v$
$$ \left\{ \begin{array}{rcl} m a_m =v-g m \\ a_x M= -n \sin \theta \\ a_y M=-g M-v+n \cos \theta\\ \frac{a_y}{a_x}=\tan\theta \\ a_m=a_y \\ \end{array} \right. $$
we get at
$$ \left\{ \begin{array}{rcl} n & = & \frac{2 \sqrt{3} g M (m+M)}{m+4 M} \\ a_x & = & -\frac{\sqrt{3} g (m+M)}{m+4 M} \\ a_m& =& -\frac{g (m+M)}{m+4 M} \\ a_y& =& -\frac{g (m+M)}{m+4 M} \\ v& =& \frac{3 g m M}{m+4 M} \\ \end{array} \right. $$