In brief the distributive law for natural numbers states that:
Let $a$,$b$,$c$ naturals then $a \cdot (b+c) = a\cdot b + a\cdot c$
And this could be generalized by induction:
Let $a, a_1, a_2, \ldots a_n$ naturals then $a\cdot (a_1 + a_2 + \ldots +a_n) = a \cdot a_1 + a\cdot a_2 + \ldots +a\cdot a_n$
Those are valid propierties with other objects, for example, integers, real numbers, complex numbers, matrices, functions, etc. because their definition is based on this.
But what happens when $n$ is not a fixed natural but a variable? I'm interested in this because I want to know if the following is valid:
Let $N$ be a natural number, then: $$ N = \overbrace{1+1+\ldots +1}^{N- times}$$ and multiplying by N on the left in both sides of the equality we get $$ N\cdot N = N \cdot(\overbrace{1+1+\ldots +1}^{N- times}) $$ now the left hand side becomes $N^2$ and until this point I agree this is valid. But I'm not sure that $N \cdot(\overbrace{1+1+\ldots +1}^{N- times}) = \overbrace{N + N + \ldots + N}^{N- times}$ becasue this will bring a contradiction if we think this as a function. $$N^2 = \overbrace{N + N + \ldots + N}^{N- times}$$ and derive both side with respect to N $$ \frac{d}{dN}(N^2) = \frac{d}{dN}\left((\overbrace{N + N + \ldots + N}^{N- times})\right) \\ 2N = \overbrace{1 + 1 + \ldots + 1}^{N-times} = N$$
And clearly the function $N$ is not equal to the function $2N$, hence a contradiction
I'm sure that the distributive law is failing with the derivative operator, but I'm not sure with the multiplication operator.
Being more specific: if $c$ is a constant and $v$ a variable is the following assertion valid? $$\overbrace{ c + c +c \ldots +c }^{v -\text{times}} =^{?} c \cdot(\overbrace{1+1+\cdot+1}^{ v-\text{times}}) $$
EDIT
Because some users identified this as a possible duplicate of: Where is the flaw in this "proof" that 1=2? (Derivative of repeated addition). I want to add more information to explain why that does not answer my question.
My current question is not about the derivative or why the proof fails, that is well answered there. My query is, as stated in the title, about the validity of distributive law when the amount of terms are variables. Another example:
Let $n$ be a constant thus $$ \sum_{k=0}^{n} 2^k = 2^0+2^1+...+2^n$$ (the upper n-times brace is obviated here) but if $n$ is a variable we could tend to infinity but this may cause trouble when trying to apply the basic arithmetic law: $$\sum_{k=0}^{\infty} 2^k = 2^0+2^1+2^2+... \\ = 1 + 2 \cdot (2^0 + 2^1 + 2^2+ \ldots ) \text{(Distributive law when $n$ variable tend to infinity)} \\ = 1 + 2 \cdot \sum_{k=1}^{n} 2^k $$ But this is absurd because if the identity holds then: $$\sum_{k=0}^{\infty} 2^k = -1$$ The sum of only positive numbers being a negative number. So we cannot apply freely the basic properties of numbers when they are variable because that variable may behave like infinity.
EDIT 2
Well, I will be the most specific I could reach here and if this doesn't have an answer I give up.
Let $a$ be a number and $\{a_j\}_{ j\in J}$ an indexed collection of numbers. Then $$ a \cdot \sum_{j\in J}a_j = \sum_{j\in J}a\cdot a_j$$ if $J$ is finite. That's for sure, we begin with the (I think axiom) distributive law for naturals.
But what if J is not finite. ie. be infinity but numerable or infinity but not numerable. This property still holds? If so why? because the generalization of induction uses a set not finite but numerable. So it may not work when the set of index is not finite and not numerable.