What is a substitute/complement in terms of mixed partial derivatives? I am trying to understand how substitutability relates to mixed partial derivatives. I thought the change in marginal utility with respect to a change in the amount of $x$ would correspond to $$\frac{\partial U}{\partial x}$$ so I got confused when I take the partial of that with respect to $y$. Does this measure the rate MU changes wrt $x$ as we change $y$? How is that related to being a substitute?
It is very important here to note that there are multiple, mutually inconsistent, possibilities for how to define a substitute/complement.

One way is to say that $x$ and $y$ are complements if an increase in $y$ raises the marginal utility of $x$ (or, given symmetry of mixed partials, vice versa):
$$\frac{\partial^2 U}{\partial x\partial y}&gt;0\tag{1}$$This is the suggestion in foobar's answer.

Another way is to say that $x$ and $y$ are complements if a decrease in the price of $y$ raises the Hicksian (aka compensated) demand for $x$. Since Hicksian demand is the derivative of the cost (aka expenditure) function by Shephard's lemma, this can also be expressed as a condition on mixed partials:
$$\frac{\partial^2 C}{\partial p_x\partial p_y}&lt;0\tag{2}$$
This is the suggestion in snoram's comment, and it is the notion more commonly taught in micro classes.

These definitions are not equivalent! Indeed, in any case with only two goods, those two goods must be substitutes according to (2), regardless of whether the cross-partial of $U$ in (1) is positive or not.

One can give fruitful labels to these concepts (though these labels are more common in the case of production rather than utility functions). Following Hicks, we can call complements by definition (1) q-complements: if $x$ and $y$ are q-complements, an increase in the quantity of $y$ leads to an increase in the marginal value of $x$. Meanwhile, we can call complements by definition (2) p-complements: if $x$ and $y$ are p-complements, a decrease in the price of $y$ leads to an increase in the demand for $x$. See, for instance, Seidman (1989) for a brief overview.

Both concepts are useful in different situations - it depends on what you're interested in!



More technical note: you might notice that (1) and (2) do not seem very similar to each other: (2) is a compensated concept, keeping us on the same indifference curve, while (1) is not. This is a valid criticism, and indeed there is an alternative notion of "q-complements" that is compensated, and a notion of "p-complements" that is not. 

The compensated notion of q-complements, which is probably more relevant for most consumer theory applications than (1), asks whether the marginal return to $x$ increases as we increase $y$, while staying on the same indifference curve. (It's more relevant for consumer theory because it doesn't depend on the inherently ambiguous cardinality of $U$. Indeed, apparently Hicks introduced this as the consumer-theory definition of "q-complements" in his 1956 Revision of Demand Theory, though I don't have a copy of it myself.) This notion also has a mixed partial characterization, in terms of something called the distance function, which is a cool micro theory tool that no one learns anymore; the matrix of mixed partials of the distance function is called the Antonelli matrix, and it is a generalized inverse of the beloved Slutsky matrix. 

If we wanted to think about other versions of p-complements, there are several options. One way is to hold income constant, and say that $x$ and $y$ are complementary if a decrease in the price of $y$ increases Marshallian demand for $x$. This is a valid notion (called "gross" complementarity rather than "net"), but it's not very nice because it's not symmetric (due to income effects) and hence doesn't have a mixed partial characterization. 

Another, nicer way is to hold marginal utility of wealth constant (this is called "Frisch" demand, and is the consumer theory analog of profit maximization, which holds price of output constant), and then ask whether a decrease in the price of $y$ leads to an increase in the demand for $x$. This depends on entries in the inverse of the Hessian matrix of mixed partials of $U$, revealing an inverse relationship with (1) (which depends on the Hessian matrix itself) that parallels the inverse relationship noted above between the Antonelli and Slutsky matrices.