Motion of an object can degrade MR images and imposes constraints on scan parameters that can in turn compromise image quality. The cause of the degradation is that the acquisition is time-dependent, and the Fourier transform of the image seen during acquisition changes due to the deformation of the object. This causes inconsistencies in *k*-space and hence ghosts in the image.

Standard motion correction methods make assumptions on the type of motions, for example, that it is a translation or a rotation, and use formulas on Fourier transforms to correct the data (1–3). We assume here that these data are acquired in shots. When the data positions at each shot are *known*, an empirical motion correction method could be used to spatially transform the ghosted image by the transformation corresponding to a shot, pick the *k*-space lines corresponding to that shot, and repeat this operation for all shots (this is a version of the method used in (1)). We could then rebuild an image by inverse Fourier transform. This method is in general incorrect, as shown by the difference between translations and rotations. Correcting translation requires only pointwise phase changes in *k*-space. On the other hand, correcting rotations requires knowledge of the data at neighboring *k*-space positions and these are acquired at *different times*. Before applying the Fourier rotation theorem, we would need to “synchronize” neighboring values. Furthermore, complicated motions such as nonrigid deformations cannot have a simple description in Fourier space. Here, however, we show that it is possible to correct complicated motions, including nonrigid motions. We give a full mathematical description of the problems involved; the motion corruption is entirely described by a large matrix acting on the space of images. Thus, inversion of this matrix should correct the motion's effects. This approach is of theoretical interest, but its practical value depends on how easily we can find a solution of the linear system. It turns out that with some careful linear algebra, not only are we able to invert in a generalized sense, but also this inversion can be done efficiently in practice. For this we use the LSQR algorithm, which is a robust implementation of the conjugate gradient of the normal equation (see (4)).

This leaves the question of finding what motion actually happened. Different cost functions have been designed to quantify how much an image has been corrupted (1, 5, 6). We explore different cost functions in conjunction with our motion correction. Optimization of such cost functions means repeating the matrix inversion iteratively. However, inverting matrices repeatedly may be prohibitive even if it is practicable on a one-off basis. We therefore also investigate the use of the empirical method described above. The matrix equation allows us to find when this approximation is correct. We show three-dimensional random affine and pulsatile nonrigid motion corrections on simulated data and an example of nonrigid correction of in vivo data (moving legs).