Recall that in producing the image onto screen, the projection window is mapped to the device window. Also, the upper-left corner of the device window has coordinates (0, 0) and corresponds to the point (left, top) in the projection window. Also, the lower-right corner of the device window (width, height) corresponds to (left+width, bottom) in the projection window. Since the mapping is a linear function for each coordinate x and y, the mapping for the x coordinate is
f(x) = (deviceWindow.width / projectionWindow.width) 
           * (x - projectionWindow.left)
where x is the x-ccordinate of a point in the projection window. Solving for x in this equation gives the inverse mapping that appears here.