The given function \( Z = ax + by \) attains its maximum value at points \((8, 2)\) and \((4, 6)\). At these points:
\[Z_1 = 8a + 2b \quad \text{and} \quad Z_2 = 4a + 6b\]
Since both points yield the same maximum value:
\[8a + 2b = 4a + 6b\]
Simplify the equation:
\[8a - 4a = 6b - 2b\]
\[4a = 4b\]
\[a = b\]
Using the condition \( ab = 25 \):
\[a \cdot b = 25 \quad \text{and} \quad a = b\]
\[a^2 = 25 \implies a = 5 \quad \text{and} \quad b = 5\]
Substitute \( a = 5 \) and \( b = 5 \) into \( Z = ax + by \). At point \((8, 2)\):
\[Z = 8a + 2b = 8(5) + 2(5) = 40 + 10 = 50\]
Thus, the maximum value of \( Z \) is 50.