40x/64ydivided by 5x/8y would be better written as
40x/64y
------------ which in turn would be clearer if written as
5x/8y
40x
--------
64y
==========
5x
------
8y
Now invert (5x/8y) and multiply (40x/64y) by your result:
40x 8 y
-------- * ------ Reducing, we get 8/8, or 1. The answer is 1.
64y 5x