Frictional force on an inclined plane with applied force = Mgsinx - Mgcos x? 
I was reading Introduction to Classical Mechanics (Morin) recently and came across this example, which said that the friction force (marked $F_f$) is $Mg\sin\theta - Mg\cos\theta$. However, I can't see why this would be: The leg of the triangle bounded by $Mg$, $F_f$, and the dotted line on the top right hand side seems to show that $F_f = Mg\cos\theta - Mg\sin\theta$, subtracting the force on the other triangle with angle $\theta$ on the bottom left hand side, which seems to be clearly $Mg\sin\theta$.
Where am I wrong?
Edit: I'm sorry for not presenting the problem as shown in Morin. The $Mg$ arrow to the right is the applied force. Here is the exact question:

A block of mass $M$ rests on a plane inclined at angle $\theta$ (see Fig. $1.2$). You apply a horizontal force of $Mg$ to the block, as shown.
Assume that the friction force between the block and plane is large enough to keep the block at rest. What are the normal and friction forces (call them $N$ and $F_f$ ) that the plane exerts on the block?

 A: Setting up Newton's 1st law along the slope:
$$\sum F=0\\
F_f-(Mg)_{x, left} +(Mg)_{x, right}=0 \\
F_f-Mg\sin(\theta) +Mg\cos(\theta) =0 \\
F_f=Mg\sin(\theta) - Mg\cos(\theta) $$
I don't see the confusion. Maybe you tried to solve this in your head, which usually makes one stuck in believing the signs are wrong along the way because some final rearranging is missing. Maybe the terms were not moved to the other side of the equal sign? Always write out the full equation. 
A: I think the difficulty is that you are not stating the whole of the problem as given by Morin.  You are only giving us part of it, out of context.  That is why it is confusing.
The puzzling force $Mg$ acting horizontally to the right (which I shall call $P$) is probably the applied force mentioned in the title.  Giving $P$ the value $Mg$ seems designed to cause confusion!  
(You do not say if $P$ is the minimum force required to keep the block from slipping downhill or the maximum before it starts moving uphill - this information will be needed to work out the coefficient of limiting static friction.)  
Assuming the block is in static equilibrium, the net force acting up the plane is :
$$F_f + P\cos\theta - W\sin\theta = 0$$
where $W=Mg$ is the weight of the block, applied force $P=Mg$ also, and $F_f$ is the friction force (assumed to act up the plane; if -ve it acts downhill).  This rearranges to give the equation you require.
Your mistake seems to be that you are interpreting $F_f$ as the component of $P$ acting up the incline and writing $F_f = P\cos\theta = Mg\cos\theta$.  However, $F_f$ and $P$ are not related in this way. 
