One example of how field gradients can help solve problems is slice selection. Remember that the RF pulse we use to make protons precess must have the same frequency as the protons' Larmor frequency. Here, however, the protons have different Larmor frequencies depending on their distance along the Y-axis.
<p>The RF pulse shown has a frequency equal to the Larmor frequency of the protons sitting on the X-axis, but it's faster than those to the left of the X-axis and slower than those to the right. The result is that only those on the X-axis precess in the significant way, and thus we will only get measurable signal from them. This is one way that MRI slices can be acquired. If techniques like this were not possible, the entire patient's body would be sending signal at once, and it would not be possible to reconstruct individual voxels.
</p>
The other techniques used to achieve spatial discrimination between signals are called phase-encoding and frequency-encoding.  While they are somewhat more complicated than the technique shown here, they are both based on the principle that a field gradient changes the Larmor frequency of the protons with respect to each other.
<a rel="nofollow" class="external text" href="https://www.youtube.com/user/overtone1000">Tyler Moore</a>
CC BY 3.0
<bdo lang="en" dir="ltr"><a href="//commons.wikimedia.org/wiki/Commons:YouTube_files" title="Commons:YouTube files">YouTube</a>: <a rel="nofollow" class="external text" href="https://www.youtube.com/watch?v=TS8HFHML0ac"><bdi lang="">Slice Selection (expand the description below for a detailed explanation)</bdi></a> – View/save archived versions on <a rel="nofollow" class="external text" href="https://web.archive.org/web/*/https://www.youtube.com/watch?v=TS8HFHML0ac">archive.org</a> and <a rel="nofollow" class="external text" href="https://archive.today/https://www.youtube.com/watch?v=TS8HFHML0ac">archive.today</a></bdo>