Math Help - How to get the third value, which the first and the second value already have

1. How to get the third value, which the first and the second value already have

I try to get the third value from the problem below, which i have already know the left two value, the problem as below:

Code:
target size (in centimeter):
width = 29.7cm
height = 21cm
target distance from camera:
d(distance)= 60cm
the occupied pixels in image by target:
width = 323pixel
height = 227pixel
d = 120cm
width = 158pixel
height = 113pixel
Question:
Now
1. how to caculate Real Size if distance and pixels are given?
2. how to calculate distance if Real Size and pixel are given?
3. how to calculate pixels if the Real Size and distance is given?

Note: If distance is become greater, the size in pixel become smaller
and if Real Size became greater, the size in pixel also became greater