# The Basics of MRI

## THE MATHEMATICS OF NMR

### Logarithms and Decibels

Scientists have many shorthand ways of representing numbers. These representations make it easier for the scientist to perform a calculation or represent a number. A logarithm (log) of a number x is defined by the following equations. If

x = 10y

then

log(x) = y.

You will see in the next section, logarithms do not need to be based on powers of 10.

Logarithms are useful, in part, because of some of the relationships when using them. For example,

log(x) + log(y) = log(xy)
log(x) - log(y) = log(x/y)
log(1/x) = log(x-1) = -log(x)
log(xy) = y log(x)

A useful application of base ten logarithms is the concept of a decibel. A decibel is a logarithmic representation of a ratio of two quantities. For the ratio of two power levels (P1 and P2) a decibel (dB) is defined as

dB = 10 log(P1/P2).

Sometimes it is necessary to calculate decibels from voltage readings. The relationship between power (P) and voltage (V) is

P = V2/R

where R is the resistance of the circuit, which is usually constant. Substituting this equation into the definition of a dB we have

dB = 10 log((V21/R)/(V22/R))
dB = 10 log((V21)/(V22))
dB = 10 log((V1)/(V2))2
db = 20 log(V1/V2).

### Exponential Functions

The number 2.71828183 occurs so often in calculations that it is given the symbol e. When e is raised to the power x, it is often written exp(x).

ex = exp(x) = 2.71828183x

Logarithms based on powers of e are called natural logarithms. If

x = ey

then

ln(x) = y,

Many of the dynamic MRI processes are exponential in nature. For example, signals decay exponentially as a function of time (t). It is therefore essential to understand the nature of exponential curves. Three common exponential functions are

y = e-t/τ y = (1 - e-t/τ y = (1 - 2e-t/τ where τ is a constant.

### Trigonometric Functions

The basic trigonometric functions sine and cosine describe sinusoidal functions which are 90o out of phase.

The trigonometric identities are used in geometric calculations. Sin(θ) = Opposite / Hypotenuse
Cos(θ) = Adjacent / Hypotenuse
Tan(θ) = Opposite / Adjacent

Csc(θ) = 1 / Sin(θ) = Hypotenuse / Opposite
Sec(θ) = 1 / Cos(θ) = Hypotenuse / Adjacent
Cot(θ) = 1 / Tan(θ) = Adjacent / Opposite

Three additional identities are useful in understanding how the detector on a magnetic resonance imager operates.

Cos(θ1) Cos(θ2) = 1/2 Cos(θ1 - θ2) + 1/2 Cos(θ1 + θ2)

Sin(θ1) Cos(θ2) = 1/2 Sin(θ1 + θ2) + 1/2 Sin(θ1 - θ2)

Sin(θ1) Sin(θ2) = 1/2 Cos(θ1 - θ2) - 1/2 Cos(θ1 + θ2)

The function sin(x) / x occurs often and is called sinc(x). ### Differentials and Integrals

A differential can be thought of as the slope of a function at any point. For the function the differential of y with respect to x is  An integral is the area under a function between the limits of the integral.  An integral can also be considered a summation; in fact most integration is performed by computers by adding up values of the function between the integral limits. ### Vectors

A vector is a quantity having both a magnitude and a direction. The magnetization from nuclear spins is represented as a vector emanating from the origin of the coordinate system. Here it is along the +Z axis. In this picture the vector is in the XY plane between the +X and +Y axes. The vector has X and Y components and a magnitude equal to

( X2 + Y2)1/2

### Matrices

A matrix is a set of numbers arranged in a rectangular array. This matrix has 3 rows and 4 columns and is said to be a 3 by 4 matrix. To multiply matrices the number of columns in the first must equal the number of rows in the second. Click sequentially on the next start buttons to see the individual steps associated with the multiplication.    ### Rotation Matrices

A rotation matrix, Ri(θ), is a three by three element matrix that rotates the location of a vector V about axis i to a new location V'.

[V'] = [Ri(θ)] [V].

Rotation matrices are useful in magnetic resonance for determining the location of a magnetization vector after the application of a rotation pulse or after an evolution period. Using the conventional magnetic resonance coordinate system, which will be introduced in Chapter 3, the three rotation matrices are as follows.

RX(θ) RY(θ) RZ(θ) ### Coordinate Transformations

A coordinate transformation is used to convert the coordinates of a vector in one coordinate system (XY) to that in another coordinate system (X"Y"). A coordinate transformation can be achieved with one or more rotation matrices. For example, if a new coordinate system is rotated by ten degrees clockwise about +Z and then 20 degrees clockwise about +X, the position of the vector, V, in the new coordinate system, V', can be calculated by

[V'] = [R+X(θ=20)] [R+Z(θ=10)] [V].

### Convolution

The convolution of two functions is the overlap of the two functions as one function is passed over the second. The convolution symbol is . The convolution of h(t) and g(t) is defined mathematically as The above equation is depicted for rectangular shaped h(t) and g(t) functions in this animation. ### Imaginary Numbers

Imaginary numbers are those which result from calculations involving the square root of -1. Imaginary numbers are symbolized by i.

A complex number is one which has a real (RE) and an imaginary (IM) part. The real and imaginary parts of a complex number are orthogonal. Two useful relations between complex numbers and exponentials are

e+ix = cos(x) +isin(x)
and
e-ix = cos(x) -isin(x).

The quantity e+ix is said to be the complex conjugate of e-ix. In other words, the complex conjugate of a complex number is the number with the sign of the imaginary component changed.

### Fourier Transforms

The Fourier transform (FT) is a mathematical technique for converting time domain data to frequency domain data, and vice versa. The Fourier transform will be explained in detail in Chapter 5.

### Problems

1. In a right triangle the hypotenuse is 5 cm, and the remaining two sides are 3 cm and 4 cm. What is the size of an angle opposite the 3 cm long side? 2. What is the integral of y between 0 and 5 where y = 3x2 + 3 ? 3. What is the slope of the function y = 3x2 + 3 at x = 2 ? 4. What is the product of eiA with eiB 5. You have some laboratory data which has the functional form y = e-x/t. What could you plot as a function of x to make the data linear? 6. What is the product of these two matrices?  7. Given that M = Mo(1 - 2e-t/T1), what is the value of T1 when M=0?

8. If V1 = 5 volts and V2 = 0.2 volts, V2 is how many dB less than V1?

9. What is the product of two cosine waves of frequencies ν1 and ν2?

10. What is the result of multiplying the following vector by the matrix? 11. Show that [Cos(x) + iSin(x)] [Cos(y) + iSin(y)] = Cos(x+y) + iSin(x+y).

12. Show that ex ey = e(x+y) .

13. What is the rotation matrix for a 180° rotation about -Y in the standard magnetic resonance coordinate system?