I agree with thegift_guitar. I hope my solution is helpfull if not right
You are quite right george differentiation does not work by differentiating a constant however this is not what has been done here, as x is the variable which is being differentiatied repectively. This means it has to be differentiated in order to maintain consistency as one of the x variables changes the other one changes by the same degree so must be taken account of, as differentiation is basically a measurement for rate of change.
Basically you would have (x+x+x+x...) x lots of times
this can be differentiated by using the product rule.
The product rule gives us a method to differentiate the product of two or more functions.
It states that when k (x) = f (x) g (x)
then k ' (x) = f ' (x) g (x) + f (x) g ' (x)
f(x) = (x+x+x+x...) and g(x)= x
so (1+1+1+1...) xlots of times + (x+x+x+x...) 1 lots of times
this can be rewritten as x+ x = 2x
dy/dx(x²) = 2x
it shows that 2x = 2x ie 1 = 1