\(xy-x-2y=21\)
\(\Rightarrow x\left(y-1\right)=21+2y\)
\(\Rightarrow x=\dfrac{2y+21}{y-1}\)
Vì \(x\) là số nguyên nên \(\left(2y+21\right)⋮\left(y-1\right)\)
\(\Rightarrow\left(2y-2+23\right)⋮\left(y-1\right)\)
\(\Rightarrow23⋮\left(y-1\right)\)
\(\Rightarrow y-1\inƯ\left(23\right)\)
\(\Rightarrow y-1\in\left\{1;-1;23;-23\right\}\)
\(\Rightarrow y\in\left\{2;0;24;-22\right\}\)
\(\Rightarrow x\in\left\{25;-21;3;1\right\}\)
-Vậy các cặp số \(\left(x;y\right)\) là \(\left(2;25\right)\), \(\left(0;-21\right)\), \(\left(24;-21\right)\), \(\left(-22;1\right)\).