let

such that p,q are prime numbers

g.c.d(a,b) the product of the similar primes in a and b say

x is integer number, there exist such x since g.c.d is square

y is integer, there exist such y since l.c.m is square

note that

in other word

and are relatively primes

g.c.d(a,b) , , all of them are squares

say

s,t are integers now

so a,b are squares