What maths rule allows this expression with powers to be rewritten as below?

36 Views Asked by At

I have been reading through a programming book and the author asked to calculate the following expression in the program.

$$4*5^3+6*5^2+7*5+8$$

I approached this by expanding the expression like so:

$$(4*5*5*5)+(6*5*5)+(7*5)+8$$ $$500+150+35+8 = 693$$

In his solution he states that the expression can be rewritten as:

$$((4*5+6)*5+7)*5+8$$ $$(26*5+7)*5+8$$ $$(130+7)*5+8$$ $$(137*5)+8$$ $$685+8 = 693$$

Which produces the correct answer, but there is no explanation as to why this works. I wasn't aware the expression could be rewritten like this and the only pattern I can see is that the five to the power of x is decreasing by one each time.

Is there a technical name for this rule? I am curious to know why this works.

3

There are 3 best solutions below

1
On BEST ANSWER

The main rule used is the distributivity rule which states that for real $a,b,c$, $$a(b+c)=ab + ac.$$

This rule can easily be used on more than $2$ summands, so say you have a real number $a$ and $n$ real numbers $b_1,\dots, b_n$.

Then,

$$a(b_1+\cdots + b_n) = ab_1 + ab_2 + \cdots + ab_n$$

This means that

$$\begin{align}4\cdot 5^3 + 6\cdot 5^2 + 7\cdot 5 + 8 &= (4\cdot 5^2\cdot 5 + 6\cdot 5\cdot 5 + 7\cdot 5) + 8 \\&= (4\cdot 5^2+6\cdot 5 + 7)\cdot 5 + 8,\end{align}$$

where the second row follows from the first precisely because of the rule written above (and the fact that multiplication is commutative, which is why I can have $5$ on the right side instead of the left).

Using the same rule again on the expression in parentheses, you can see that

$$4\cdot 5^2 + 6\cdot 5 + 7 = 4\cdot 5\cdot 5 + 6\cdot 5 + 7 = (4\cdot 5 + 6)\cdot 5 + 7$$

0
On

This rule is called distributivity :

$$ (a+b)c = ac + bc. $$

The author successively used this property on the common factor $5$.

1
On

I learned it under the name "Horner's rule" for polynomial evaluation, e.g.,

$$4x^3+6x^2+7x+8=((4x+6)x+7)x+8$$

The basic idea is that the number of multiplications called for on the right hand side is precisely the degree of the polynomial, whereas on the left hand side it's more, especially if you approach it mindlessly from left to right as $4\cdot x\cdot x\cdot x+6\cdot x\cdot x+7\cdot x+8$. Back (in my youth) when computations were done by hand, anything that reduced the number of multiplications was a godsend.