well i will tell you what my sir told me when i asked the same 2 months back in my class
he came the other way round
x=1+1+1+1........(x times) (1)
since x is variable ......it is compulsory that you have to multiply the below way
x2=x+x+x+x+x............(x2 times)
when you multiply a variable on both sides ...you need to multpily tht variable on both the sides ....including the no.of terms too (dont ask me why )
now differentiate w.r.t. x
2x = 1+1+1+1+1......... (2x times ) =2x (2)
such calculations must be done because .....x is unknown ....and variable
if x was not a variable ........what ever you gave in the question wud have been applicable
if you are not satisfied .....chck the eqns 1 and 2 by putting x values
for e.g. x=3
=> 3=1+1+1(3 times )
where as 2x is 6 = 1+1+1+1...(2x times i.e.6 times)
now dont ask me about the other eqn x2=x+x+x....... i am helpless over there
...even i was not completely satisfied .