$\frac{59}{320} \mod{5}$ The example in the title is just an example really, but I'm wondering how do you calculate $\frac{a}{b} \mod{p}$ when $5 \mid b$, since then $b$ does not have an inverse?  Thanks!
 A: $$320=5\cdot 64=0\pmod 5\implies \frac{59}{320}=\frac40\pmod 5$$
and just as with the real numbers dividing by zero is not well defined, so the fraction is actually unexisting if one wishes to work modulo $\;5\;$ .
A: One may use fraction notation $\,x = a/b\,$ to denote the solution of the equation $\,bx = a\,$ only when such a solution both exists and is unique (either of which may fail in modular arithmetic).
Let's consider your example. If the lowest terms fraction $\,x = a/(5b)$ exists modulo $\,5\,$  then $\ a\equiv 5bx\equiv 0\pmod 5,\,$ so $\ 5\mid a,\,$ contra to our hypothesis that the fraction is in lowest terms. Hence the fraction $\,a/(5b)$ does not exist modulo $\,5\,$ when $\,5\nmid a,\,$ i.e. when the denominator is $\equiv 0$ but the numerator is $\not\equiv 0.\,$  However, if $\,a\equiv 0\,$ then the associated linear equation is $\,0\equiv 0\,$ so every element $\,x\,$ is a solution. This nonuniqueness occurs not only in the form $\,0/0\,$ but also in the form $\,ac/(bc)\,$ when $\,c\,$ is a nontrivial factor of the modulus, i.e. a zero-divisor, as we next show.
Consider $\, x \equiv2/2\pmod{10},\,$ i.e. "the" solution of $\,2x-2\equiv 0\pmod{10}.\,$
By definition this is true iff $\,10\mid 2x-2\iff 5\mid x-1\iff x\equiv 1\pmod{5}.\,$ This solution lifts to two solutions $\,x\equiv 1,6\pmod{10}.\,$ Thus, while the fraction exists, it does not uniquely exist, so the  fraction $\,2/2\,$ is not well-defined modulo $10.\,$ In particular this means that we cannot cancel the $2$ to deduce that $\,2/2 \equiv 1/1\equiv 1\,$ (it is valid to can cancel common factors that are coprime to the modulus, but we cannot cancel zero-divisors - that is the modular generalization of dividing by zero).
Generally  $\,a/b\,$ uniquely exists mod $\,m\,$ iff $\,b\,$ is coprime to the modulus, since then $\,c\equiv b^{-1}\,$ exists (e.g. by Bezout), and such inverses are always unique $\, c'\equiv c'(bc)\equiv (c'b)c\equiv c.\,$ Modular fraction arithmetic is valid as long as one restricts only to fractions with denominator coprime to the modulus. If you later study abstract algebra you will learn that this is a special case of the universal property of fraction fields and localizations.  See also this answer.
