TITLE: Solving for different variables
QUESTION [0 upvotes]: I've been trying to solve this for n, but I haven't been successful. 
$$S= n[2a+(n-1)d]$$
I've started by multiplying $(n-1)d$ since it is within parenthesis.
Following, I've added it to $2a$ which is inside the square bracket.
Finally, I've multiply by the n which is outside the square bracket.
I got to this:
                              $$S= 2na + n^2d - nd$$
I have tried factoring it. However, I still wasn't able to solve it for "$n$".
Any suggestions ?

REPLY [2 votes]: Hint: Your equation is equivalent to $$S=2an+(n^2-n)d$$
$$0=n^2d-nd+2an-S$$
$$0=n^2-n+\frac{2a}{d}n-\frac{S}{d}$$
$$0=n^2+n\left(\frac{2a}{d}-1\right)-\frac{S}{d}$$ for $d\neq 0$ now use the quadratic formula.
{"set_name": "stack_exchange", "score": 0, "question_id": 2736831}