Let the ages of A and B be \(4x\) and \(5x\) respectively, derived from the given ratio. The sum of their ages is stated as 72, leading to the equation:
\[4x + 5x = 72\]Combining like terms yields:
\[9x = 72\]Solving for \(x\):
\[x = \frac{72}{9} = 8\]B's age is then determined by multiplying \(x\) by 5:
\[5 \times 8 = 40\]Therefore, B is 40 years old.