Why does $\frac{MP_L}{MP_K} = \frac{w}{r}$? I did a practice problem set. I was given a production function $F(K,L)$ and had to derive the firm's cost function. To do this, I used the following relationship: 

\begin{equation}
\frac{MP_L}{MP_K}=\frac{w}{r}
\end{equation}

I found this formula in a set of lecture notes online. I have no idea where it comes from. I understand what $MP_K$, $MP_L$, $w$, and $r$ are but I don't know why these ratios are equal. I got the problem correct, but I want to understand this point better. 

My Question: 

Can someone explain why this ratio is true?
This is a result of firm maximization.  Consider a problem that a profit maximizing firm faces --it must rent capital, $k$, at rate $r$ and hires labor, $l$, at wage $w$ to produce goods ($F(k, l)$) for which we can sell at a normalized price of 1.

$$ \max_{k, l} F(k, l) - w l - r k $$

Then if we just think about the firm's maximization, we can take derivatives w.r.t $k$ and $l$ to get:

$$ F_k(k, l) - r = 0 $$
$$ F_k(k, l) = r $$

and

$$ F_l(k, l) - w = 0 $$
$$ F_l(k, l) = w $$

Notice that by definition $MPL_K = F_k(k, l)$ and $MP_L = F_l(k, l)$.  If we take the ratio of the two equations then we get what you initially introduced --that is:

$$ \frac{F_l(k, l)}{F_k(k, l)} = \frac{MP_L}{MP_K} = \frac{w}{r} $$

Edit: As mentioned in another answer, this is imposing some assumptions on the behavior of $F(k, l)$.  These assumptions are $\frac{\partial F}{\partial k} &gt; 0$, $\frac{\partial F}{\partial l} &gt; 0$ and $\frac{\partial^2 F}{\partial k^2} &lt; 0$ $\frac{\partial^2 F}{\partial l^2} &lt; 0$