Find the integral of x/cos^2(x^2)dx

The answer is 1/2 tan (x^2) + C.
Where does the 1/2 come from?

If you let u = x^2, then du = 2x dx

But you only have x dx, which is 1/2 du