For an arithmetic sequence: 2nd term - 1st term = 3rd term - 2nd term is always true, it's equal to the common difference d.
Our geometric terms are a, ar and ar^3.
We are told that these form an arithmetic sequence, so from the above:
ar - a = ar^3 - ar
divide both sides by a will give r^3 -2r+1=0 as required.