Ta có : x + y = 7
=> y = 7 - x
Lại có : x(7 - x) = 12
<=> 7x - x2 = 12
<=> 7x - x2 - 12 = 0
<=> x2 - 7x + 12 = 0 (chia cả hai vế cho -1)
<=> x2 - 3x - 4x + 12 = 0
<=> x(x - 3) - 4(x - 3) = 0
<=> (x - 3)(x - 4) = 0
\(\Leftrightarrow\orbr{\begin{cases}x-3=0\\x-4=0\end{cases}\Leftrightarrow\orbr{\begin{cases}x=3\left(tm\right)\\x=4\left(tm\right)\end{cases}}}\)
=> y = 4 ; 3
Ta có : |x - y| = |3 - 4| = 1
|x - y| = |4 - 3| = 1
TA có x+y=7 suy ra x=7-y
Thay vào bt x.y=12 ta có \(\left(7-y\right)y=12\Rightarrow7y-y^2=12\)
\(\Rightarrow y^2-7y+12=0\)
\(\Rightarrow\left(y-3\right)\left(y-4\right)=0\)
\(\Rightarrow\orbr{\begin{cases}y-3=0\\y-4=0\end{cases}\Rightarrow\orbr{\begin{cases}y=3\Rightarrow x=4\Rightarrow\left|x-y\right|=1\\y=4\Rightarrow x=3\Rightarrow\left|x-y\right|=1\end{cases}}}\)
Vậy \(\left|x-y\right|=1\)