Just got confused with what my friend asked (paradox and fake proofs).

What you are not considering is that while you are taking derivatives of the function on the right hand side with respect to x, the number of components is not fixed. For your example, what you are doing is basically looking at the function $$ g(x,n) = xn $$ and taking the derivative with respect to $x$ and evaluating the partial derivative at $n=x$, i.e. $g_x(x,n)|_{n=x}=n|_{n=x}=x$.

You would need to look at the total derivative of $g$ at $n=x$, i.e. $$ dg = g_{x}|_{n=x} + g_n|_{n=x} = 2x. $$


The problem, in short, is that the equation $$x^2 = \underbrace{x+\cdots+x}_x$$ only holds when $x$ is a natural number.


To truly see why this is a problem, however, you will need to already understand universal quantification and lambda abstraction. Perhaps look up some YouTube videos about these concepts, or just browse on the internet for awhile until you find good explanations.

Explicitly, what we know is:

$$\left(\mathop{\forall}_{x \in \mathbb{N}}\right)\;x^2 = \underbrace{x+\cdots+x}_x$$

In function notation:

$$\left(\mathop{\lambda}_{x \in \mathbb{N}} x^2\right) = \left(\mathop{\lambda}_{x \in \mathbb{N}} \underbrace{x+\cdots+x}_x\right)$$

So if by $D$ we mean differentiation of functions $\mathbb{R} \rightarrow \mathbb{R}$, we can't use the above equation to deduce

$$D\left(\mathop{\lambda}_{x \in \mathbb{N}} x^2\right) = D\left(\mathop{\lambda}_{x \in \mathbb{N}} \underbrace{x+\cdots+x}_x\right),$$

because neither left- nor right-hand-sides are well-defined.