x+y=6 xy=7
===> (x+y)²=6²=36
===> x²+y²+2xy=36
===> x²+y²+2*7=36
===> x²+y²=22
(x-y)²=(x+y)²-4xy=6²-4×7=36-28=8