You need to give us a bit more context here. What are x and y supposed to be – real numbers, complex numbers, vectors in a euclidean space, or what?
In fact, in every case the method is the same: form the square . Expand that, either as a product or in terms of inner products, depending on what sort of space you are working in, and see when that can be equal to . You should end up with an equation like (again, depending on the space). You then need to show why that can only happen when .