Let's denote:
- \( h \) as the height of the water in both tanks.
- \( V_X \) as the volume of water in Tank X.
- \( V_Y \) as the volume of water in Tank Y.
Given that the height of water in both tanks is equal, and when all the water from Tank Y is poured into Tank X, 4 liters of water overflow, we can set up the equation:
\[ V_X + V_Y - 4 = V_X + V_Y \]
Solving for \( V_Y \), we get:
\[ V_Y = 4 \, \text{liters} \]
Now, to find the total amount of water in both tanks (\( V_X + V_Y \)), we need to find \( V_X \). We'll use the formula for the volume of a rectangular tank:
\[ V = \text{base area} \times \text{height} \]
For Tank Y:
\[ V_Y = \text{base area}_Y \times h \]
\[ 4 = (48 \times 25) \times h \]
\[ h = \frac{4}{1200} \]
\[ h = \frac{1}{300} \]
Now, for Tank X:
\[ V_X = \text{base area}_X \times h \]
\[ V_X = (50 \times 40) \times \frac{1}{300} \]
\[ V_X = \frac{1}{3} \]
So, the total amount of water in both tanks is \( V_X + V_Y = \frac{1}{3} + 4 = \frac{13}{3} \) liters.
Now, to find the total capacity of Tank Y, we use the formula for the volume of a rectangular tank:
\[ \text{Volume}_Y = \text{base area}_Y \times \text{height} \]
\[ \text{Volume}_Y = (48 \times 25) \times \frac{1}{300} \]
\[ \text{Volume}_Y = 4 \]
Therefore, the total capacity of Tank Y is 4 liters.