3. (AUS 4) Ali Barber, the carpet merchant, has a rectangular piece of carpet whose dimensions are unknown. Unfortunately, his tape measure is broken and he has no other measuring instruments. However, he finds that if he lays it flat on the floor of either of his storerooms, then each corner of the carpet touches a different wall of that room. He knows that the sides of the carpet are integral numbers of feet and that his two storerooms have the same (unknown) length, but widths of 38 feet and 50 feet respectively. What are the carpet dimensions?
3. Let the carpet have width $x$, length $y$. Let the length of the storerooms be $q$. Let $y / x=k$. Then, as in the previous problem, $(k q-50)^{2}+(50 k-q)^{2}=$ $(k q-38)^{2}+(38 k-q)^{2}$, i.e., 
$$ k q=22\left(k^{2}+1\right) $$
Also, as before, $x^{2}=\left(\frac{k q-50}{k^{2}-1}\right)^{2}+\left(\frac{50 k-q}{k^{2}-1}\right)^{2}$, i.e., 
$$ x^{2}\left(q^{2}-1\right)^{2}=\left(k^{2}+1\right)\left(q^{2}-1900\right) $$
which, together with (1), yields 
$$ x^{2} k^{2}\left(k^{2}-1\right)^{2}=\left(k^{2}+1\right)\left(484 k^{4}-932 k^{2}+484\right) $$
Since $k$ is rational, let $k=c / d$, where $c$ and $d$ are integers with $\operatorname{gcd}(c, d)=$ 1. Then we obtain 
$$ x^{2} c^{2}\left(c^{2}-d^{2}\right)^{2}=c^{2}\left(484 c^{4}-448 c^{2} d^{2}-448 d^{4}\right)+484 d^{6} $$
We thus have $c^{2} \mid 484 d^{6}$, but since $(c, d)=1$, we have $c^{2}|484 \Rightarrow c| 22$. Analogously, $d \mid 22$; thus $k=1,2,11,22, \frac{1}{2}, \frac{1}{11}, \frac{1}{22}, \frac{2}{11}, \frac{11}{2}$. Since reciprocals lead to the same solution, we need only consider $k \in\left\{1,2,11,22, \frac{11}{2}\right\}$, yielding $q=44,55,244,485,125$, respectively. We can test these values by substituting them into (2). Only $k=2$ gives us an integer solution, namely $x=25, y=50$.