Coefficient to create a series whose sum is a given one I realize that my title is not clear but I currently don't master math terms well enough to write a better title or to enter meaningful tags. Any correction to my question, tags and title would be very welcome and I hope to learn fast.
This is my problem: let
$$P_1 = 10$$
$$N = 5$$
$$H = 100$$
I calculate the values of the $P$ series from $P_2$ to $P_N$ like this:
$$P_k = X P_{k-1}$$
for $K$ going from $2$ to $N$ .
I am trying to find an $X$ so that $P_1 + P_2 + ... + P_N = H$ for known $P_1,N$ and $H$.
If I take $X \approx 1.35$, I get:
$$P_1 = 10.00$$
$$P_2 \approx 13.50$$
$$P_3 \approx 18.23$$
$$P_4 \approx 24.60$$
$$P_5 \approx 33.22$$
which gives a sum quite close to 100.
However, I had let $$X \approx 1.35$$ just because I knew that in that way, given those values of $P_1$ and $N$, the sum of all the elements of the $P$ series would be $\approx$ $H$ , which is the requirement.
So I'm trying to figure out how to calculate $X$ as a function of $P_1$, $N$ and $H$ such that the sum of all the resulting elements of the $P$ series is = $H$.
 A: Let $P$ be your starting value, and $X$ be the ratio between elements.
The sum of the first $N$ elements is going to be:
$H = P+XP+X^2P+X^3P+...+X^{N-1}P$
We can then multiply by $X$ to increment the exponents:
$XH = XP+X^2P+...+X^NP$
Now almost every term is the same between these two, so we can cancel most of them by subtracting:
$H-XH = P - X^NP$
$H-P = XH-X^NP$
Plugging in your values for $H$, $P$, and $N$ should then leave you with a messy but calculable* polynomial for $X$.
*Finding a nice closed form gets complicated for $N>4$, but once you have a polynomial you can approximate it with Newton's method vel sim and get as much numerical precision as you need.
A: It's possible to write the equation in terms of a polynomial equation, but above degree 4, you can't write explicit general solutions; there are iterative methods (start with a guess and repeatedly improve it) to get solutions of varying sophistication. One example is Newton's method, though there are other approaches more directly suited to solving polynomial equations.
Fortunately, if you only want a numerical solution you can nearly always get one easily in a spreadsheet like Excel or LibreOffice's Calc.
This is because your problem is directly analogous to an internal rate of return problem in finance. Here we treat it as if there were a constant sequence of payments which interest would increase in the geometric fashion you describe, and the rate of interest that made that worth the same as the required total (at the end of the sequence of payments) is one less than your $X$.
That is, if your first payment is $P_1$ and there are a total of $N$ payments which have to total $H$, put in a column $N-1$ rows with $P_1$ in it and one row with $P_1-H$ in it and then use the internal rate of return function IRR (or equivalent) in the spreadsheet, which returns one less than the $X$ value.
Here's an example done in Calc; Excel works in the same fashion:

The internal rate of return is 35.24% = 0.3524; this means your $X$ should be about 1.3524.
Neat, huh?
