Your question "Do we have any way to evaluate the equation correctly?" is yes because Mathematica allows you to define arbitrary rules to perform manipulation of expressions.
In your particular use case the simplistic code
2 Sum[A[i], {i, n}] == Sum[2 A[i], {i, n}] /. Sum[k_ x_, {y_, z_}] :> k Sum[x, {y, z}]
returns True
as you wanted. However, the code is too loose. Therefore, you may want to use the pattern k_?NumberQ
instead of just k_
. For more generality, try the code
rule = Sum[Times[Longest[u___], x___] , {y_, z___}] :>
Times[u] Sum[Times[x], {y, z}] /; (FreeQ[{u}, y]);
2 b[j] Sum[A[i], {i, n}] == Sum[b[j] 2 A[i], {i, n}] /. rule
which returns True
as you would expect. Notice the use of FreeQ
to ensure that
what is moved outside the summation does not depend on the summation index.
Also notice that the rule
allows summations over range variations such as
{i, a, b}
or {i}
.
In general, Mathematica does certain transformations to expressions automatically.
For example, the Plus
and Times
functions have attributes Orderless
and Flat
which means that they are commutative and associative. That is the reason why a + b == b + a
and a b == b a
evaluate to True
automatically by default. However, that does not extend to a (b + c) == a b + a c
which seems as though it should be true also. For cases like this Mathematica has certain transformations that are used if requested by Expand
or Simplify
. That allows the expressions
a (b + c) == a b + a c // Expand
or a (b + c) == a b + a c // Simplify
to evaluate to True
as you would expect.
In the particular case of summations, the designers of Mathematica, for unknown reasons, decided not to implement a general rule which would move factors out of a summation even if they are constant. Perhaps that may change change in future versions.