In diffusion tensor imaging (DTI) an effective diffusion tensor in each voxel is measured by using a set of diffusion-weighted images (DWIs) in which diffusion gradients are applied in a multiplicity of oblique directions. However, to estimate the diffusion tensor accurately, one must account for the effects of all imaging and diffusion gradient pulses on each signal echo, which are embodied in the b matrix. For DTI to be practical clinically, one must also acquire DWIs rapidly and free of motion artifacts, which is now possible with diffusion-weighted echo-planar imaging (DW-EPI). An analytical expression for the b matrix of a general DW-EPI pulse sequence is presented and then validated experimentally by measuring the diffusion tensor in an isotropic phantom whose diffusivity is already known. The b matrix is written in a convenient tabular form as a sum of individual pair-wise contributions arising from gradient pulses applied along parallel and perpendicular directions. While the contributions from readout and phase-encode gradient pulse trains are predicted to have a negligible effect on the echo, the contributions from other imaging and diffusion gradient pulses applied in both parallel and orthogonal directions are shown to be significant in our sequence. In general, one must understand and account for the multiplicity of interactions between gradient pulses and the echo signal to ensure that diffusion tensor imaging is quantitative.