Remember that for a triangle rectangle with known catheti (or legs) and with a known angle a, we have the relations.
cos(a) = (adjacent cathetus)/(hypotenuse)
sin(a) = (opposite cathetus)/(hypotenuse)
tan(a) = (opposite cathetus)/(adjacent cathetus)
We also know that the sum of the squares of the catheti is equal to the square of the hypotenuse.
Then if H is the measure of the hypotenuse, in this case we have:
H^2 = 6^2 + 8^2
H = √(36 + 64) = 10
H = 10
Now we can find sin(X) and cos(Y).
when we step on the angle X, the opposite cathetus is the one with a measure of 6 units, then we have:
sin(X) = (opposite cathetus)/(hypotenuse) = 6/10
sin(X) = 6/10 = 3/5
Now, when we step on the angle Y, the adjacent cathetus is the one that measures 6.
cos(Y) = (adjacent cathetus)/(hypotenuse) = 6/10
Cos(Y) = 6/10 = 3/5
So you can see that we got the exact same value for cos(Y) than for sin(X), so the ratios are equal.
This is trivial because the sum of all interior angles of a triangle is always 180°.
Then for all triangles with two internal angles X and Y, we have:
X + Y + 90° =180°
X + Y = 90°
X = 90° - Y°
Then:
cos(X) = cos(90° - Y) = sin(Y)