Perfect Complements
Some goods must be consumed in a specific proportion; we call these perfect complements. For example, suppose you enjoy drinking tea in a precise ratio of two sugar cubes for every 8 ounces of tea: more sugar is too sweet, and less isn’t sweet enough. Let’s assume that you get one “util” for every perfect 8oz cup of tea. In this case your utility from $x_1$ sugar cubes and $x_2$ ounces of tea would be \(u(x_1,x_2) = \begin{cases}{x_1 \over 2} & \text{ if } {x_1 \over 2} \le {x_2 \over 8}\\ {x_2 \over 8} & \text{ if } {x_1 \over 2} \ge {x_2 \over 8}\end{cases}\) or, more succinctly, \(u(x_1,x_2) = \min\left\{ {x_1 \over 2}, {x_2 \over 8}\right\}\) For example, if you had (16 sugar cubes, 16oz of tea), you could make two 8oz cups of tea, using 4 cubes of sugar and 16 ounces of tea, and have twelve cubes of sugar left over. At this point, getting more sugar wouldn’t raise your utility, but getting more tea would. The indifference curve passing through $(16, 16)$ would be all the combinations of sugar and tea that would give you 2 utils:
The “ridge” of the utility function occurs at the ideal proportion, where the minimands of the utility function are equal to one another: that is, where \({x_1 \over 2} \text{cubes of sugar} = {x_2 \over 8} \text{ounces of tea}\) or 4 ounces of tea for every cube of sugar. You can highlight this “ridge” by checking the box in the diagram above.
Marginal utilities and the MRS
Since this function is defined piecewise, so are its marginal utilities: \(MU_1(x_1,x_2) = \begin{cases}{1 \over 2} & \text{ if } {x_1 \over 2} \le {x_2 \over 8}\\ 0 & \text{ if } {x_1 \over 2} \ge {x_2 \over 8}\end{cases}\) \(MU_2(x_1,x_2) = \begin{cases}0 & \text{ if } {x_1 \over 2} \le {x_2 \over 8}\\ {1 \over 8} & \text{ if } {x_1 \over 2} \ge {x_2 \over 8}\end{cases}\) The MRS of this function is therefore \(MRS(x_1,x_2) = {MU_1(x_1,x_2) \over MU_2(x_1,x_2)} = \begin{cases}{1 \over 2}/0 & \text{ if } {x_1 \over 2} < {x_2 \over 8}\\ \text{undefined} & \text{ if } {x_1 \over 2} = {x_2 \over 8}\\ 0/{1 \over 8} & \text{ if } {x_1 \over 2} > {x_2 \over 8}\end{cases}\)
Intuitively, if you have any bundle $(x_1,x_2)$ such that ${x_1 \over 2}$ ≠ ${x_2 \over 8}$, you’ll have extra of one good or another; getting even more of that good won’t raise your utility at all, while getting more of the other good will allow you to use it:

Along the horizontal portions of an indifference curve, your $MU_1 = 0$ and $MU_2 = {1 \over 8}$: so you wouldn’t be willing to give up any tea to get more sugar, since you already have more sugar than you’re using. Hence the MRS is “0 ounces of tea per additional cube of sugar.”

Along the vertical portions, the reverse is true: your $MU_1 = {1 \over 2}$, while $MU_2 = 0$, so you’re not willing to give up any sugar to get more tea. At points like this, your MRS is best thought of as “0 cubes of sugar per additional ounces of tea.” We will sometimes refer to this portion of the indifference curve as having an “infinite” slope, but it’s better to think of the inverse of the slope as just being zero.
General Formulation
More generally, suppose you always want to consume $a$ units of good 1 for every $b$ units of good 2. Then your utility function would be \(u(x_1,x_2) = \min\left\{ {x_1 \over a}, {x_2 \over b}\right\}\) We call the arguments of this “min” function the minimands; the “ridge” along which these minimands are equal would occur at \(x_2 = {b \over a}x_1\) Note that as $a$ increases, the ridge has a lower slope (i.e. is closer to the “good 1” axis), while as $b$ increases, it has a higher slope (moves towards the “good 2” axis).
One final note on perfect complements: It’s easy with this utility function to flip the coefficients on the two minimands. The easiest way to avoid this confusion is to take a point you know is on the ridge line — for example, 2 cubes of sugar and 8 ounces of tea — and make sure that when you plug in $(2,8)$ the minimands are equal to one another.