Spatial Analyst provides the Cost Distance tool for calculating the least cost of getting from any cell to a source cell. Two input rasters are involved: the source raster and a cost surface raster, each of whose cells indicate a price of traversing each unit of distance in that cell.
The overall cost of the path from a given cell to the closest source cell is calculated on the basis of the least-cost path between the two cells. Calculating the total cost involves summing up the costs of crossing all the individual cells along the least-cost path. The cost of crossing an individual cell is found by multiplying the distance across that cell by the value found in the geographically equivalent cell in the cost-surface raster. Thus, the accumulated cost found in the output raster is the sum of the products formed by (a) the distance across each cell and (b) the value (the “price per unit distance for going through”) of each cell.