Well, it looks like you did some extra work. The derivative of tan(y) = sec^2(y) dy. Thus we have:
x = tan(y)
dx = sec^2(y) dy
cos^2(y) = dy/dx
We get to the final answer by dividing both sides by dx and then dividing both sides by sec^2(y).
I hope this helps.