# Calculate return on investment (ROI)

Before coming to the question, I'll quickly explain how to calculate NPV (Net present value) with an example

## Information Available

• Equipment Cost - \$20,000 • Annual Benefit - \$6,000
• Scrap Value - \$2,000 • Years in Service ($n$) - 4 Years • Inflation Rate/Interest Rate ($r$) - 7% ## What is NPV Net Present Value is the amount of money we'll have from our investment in a particular product during the course of it's service. We calculate first the Present Value (PV) by $$\textrm{PV} = \sum_{k=1}^{n-1}\left(\frac{\textrm{Annual Benefit}}{(1+r)^k}\right)\quad + \quad \frac{\textrm{Annual Benefit}+\textrm{Scrap Value}}{(1+r)^n}$$ that is, the present value of each annual benefit over the lifetime, plus the present value of the final year benefit. For Final Year, we add the scrap value to annual benefit as well. For this case the values we get are • Y1 = \$5,607
• Y2 = \$5,240 • Y3 = \$4,897
• Y4 = \$6,103 Add them all together we get \$21,849. So at the end of 4 years we made \$21,849 on an investment of \$20000 in terms of today's money.

$$\textrm{NPV} = 21,849 - 20,000 = \textbf{\1,849}$$

## ROI

Now ROI is the value of r (Interest Rate) at which NPV comes out to be 0. At a certain value of r (for this case it's 11%), when you run the formula 4 times (for four years), the four values add up to 20,000 (the initial investment)

Can you calculate it with a formula?

PS - Can someone suggest better tags?

A tl;dr version of your question is:

Given constants $n, s, a, c$, can we find a closed form expression for $r$ that solves the equation:

$$\sum_{i=1}^{n}\left ( \frac{a}{(1+r)^i}\right ) + \frac{s}{(1+r)^n} = c$$

Let us simplify. Let $t = \frac{1}{1 + r}$. Thus we have:

\begin{align} a\sum_{i=1}^{n}t^i + st^n &= c \\ at\frac{\ 1-t^n}{1-t} + st^n &= c \\ at-at^{n+1} + st^n - st^{n+1} &= c - ct \\ at-(a+s)t^{n+1} + st^n &= c - ct \\ (a+s)t^{n+1} - st^n - (a+c)t + c &= 0 \\ \end{align}

Since you want to solve for $t$, you are essentially left with having to solve a polynomial of degree $n+1$. Unfortunately, if $n \geq 4$, you are completely out of luck in finding a closed form (thanks, Galois), but you could use a simple polynomial solver to quickly get solutions for $t$ and thus $r$.

Trying this out for your example in wolfram gives the solution $t = 0.90214$ which gives $x = \frac{1}{0.90214} - 1 = 0.10848$ and thus $x = 10.8$% solves the ROI for you example.

Since there might be multiple answers to polynomial, we can place bounds on valid answers. We need $0 < r < 1$ and so:

\begin{align} 0 &< r < 1 \\ 1 &< 1 + r < 2 \\ \frac{1}{2} &< \frac{1}{1+r} < 1 \\ \frac{1}{2} &< t < 1 \end{align}

So any solution where $\frac{1}{2} < t < 1$ should be valid.

• In SymPy, t = Symbol('t'); f = (6000 + 2000) * t**5 - 2000 * t**4 - (6000 + 20000) * t + 20000; sols = solve(f,t); print sols produces a list of 5 solutions in terms of radicals. Commented Dec 23, 2016 at 14:29
• @RodrigodeAzevedo That's one specific example, not a general formula. The statement of the theorem is that there is no general formula for a quantitc or higher. Tbh this polynomial isn't the most general case either so maybe you could factor it, but clearly it isn't worth doing. Commented Dec 23, 2016 at 18:55
• Yes, but the lack of a formula for all instances does not imply that there's no formula for the instance of interest. Thinking too generally can be paralysing. Commented Dec 23, 2016 at 19:05
• @RodrigodeAzevedo Your page long monster radical is paralysing. If there is a closed form, as I said might be possible from my previous comment, instinct says it would be a beast. You are welcome to find one and share; i will personally give you an upvote. Commented Dec 23, 2016 at 19:11
• The OP wanted a formula! I gave him a formula. It makes one appreciate numerical algorithms with floating-point numbers. Commented Dec 23, 2016 at 19:15

The NPV is

$$\begin{array}{rl} \mbox{NPV} &= \displaystyle\left(\sum_{k=1}^n \frac{6000}{(1+r)^k}\right) + \frac{2000}{(1+r)^n} - 20000\\ &= \displaystyle\frac{6000}{r} \left(1 - \frac{1}{(1+r)^n}\right) + \frac{2000}{(1+r)^n} - 20000\\ &= \displaystyle\left(\frac{6000}{r} - 20000 \right) + \left( 2000 - \frac{6000}{r}\right) \frac{1}{(1+r)^n} \end{array}$$

Let $n=4$ and let us try to find for which $r$ the $\mbox{NPV}$ is zero. Using SymPy:

>>> r = Symbol('r', real=True, positive=True)
>>> NPV = (6000/r - 20000) + (2000 - 6000/r)*(1/(1+r)**4)
>>> NPV
6000
2000 - ----
r             6000
----------- - 20000 + ----
4             r
(r + 1)
>>> solve(NPV)
____________________________________________________________________________________________________________________________________________________________________________                                                                                                                  ____________________________________________________________________________________________________________________________________________________________________________                                                                                                                  ____________________________________________________________________________________________________________________________________________________________________________                        ____________________________________________________________________________________________________________________________________________________________________________
/                                                                                                         ________________________                                                                                                                                                            /                                                                                                         ________________________                                                                                                                                                            /          ________________________                                                                                                                                                                 /          ________________________
/                                                                                                         /             __________                                                                                                                                                            /                                                                                                         /             __________                                                                                                                                                            /          /             __________                                                                                                                                                                 /          /             __________
/                                                 2787                                                    /     259    \/ 60325113      89                   83                                                                                                                               /                                                 2787                                                    /     259    \/ 60325113      89                   83                                                                                                                               /          /     259    \/ 60325113      89                   83                                                              2787                                                                  /          /     259    \/ 60325113      89                   83                                                              2787
/    - -------------------------------------------------------------------------------------------- - 2*3 /   - ----- + ------------  + --- + ---------------------------------                                                                                                               /    - -------------------------------------------------------------------------------------------- - 2*3 /   - ----- + ------------  + --- + ---------------------------------                                                                                                               /    - 2*3 /   - ----- + ------------  + --- + --------------------------------- + --------------------------------------------------------------------------------------------                     /    - 2*3 /   - ----- + ------------  + --- + --------------------------------- + --------------------------------------------------------------------------------------------
_____________________________________________________________________________             /                      _____________________________________________________________________________     \/      16000      144000       200            ________________________                    _____________________________________________________________________________             /                      _____________________________________________________________________________     \/      16000      144000       200            ________________________                    _____________________________________________________________________________             /         \/      16000      144000       200            ________________________                  _____________________________________________________________________________                    /         \/      16000      144000       200            ________________________                  _____________________________________________________________________________              _____________________________________________________________________________
/                                                    ________________________             /                      /                                                    ________________________                                                    /             __________                    /                                                    ________________________             /                      /                                                    ________________________                                                    /             __________                    /                                                    ________________________             /                                                        /             __________                  /                                                    ________________________                    /                                                        /             __________                  /                                                    ________________________              /                                                    ________________________
/                                                    /             __________             /                      /                                                    /             __________                                                    /     259    \/ 60325113                    /                                                    /             __________             /                      /                                                    /             __________                                                    /     259    \/ 60325113                    /                                                    /             __________             /                                                        /     259    \/ 60325113                  /                                                    /             __________                    /                                                        /     259    \/ 60325113                  /                                                    /             __________              /                                                    /             __________
/                     83                   89        /     259    \/ 60325113             /                      /                     83                   89        /     259    \/ 60325113                                              300*3 /   - ----- + ------------                  /                     83                   89        /     259    \/ 60325113             /                      /                     83                   89        /     259    \/ 60325113                                              300*3 /   - ----- + ------------                  /                     83                   89        /     259    \/ 60325113             /                                                  300*3 /   - ----- + ------------                /                     83                   89        /     259    \/ 60325113                    /                                                  300*3 /   - ----- + ------------                /                     83                   89        /     259    \/ 60325113              /                     83                   89        /     259    \/ 60325113
/    - --------------------------------- + --- + 2*3 /   - ----- + ------------           /           4000*      /    - --------------------------------- + --- + 2*3 /   - ----- + ------------                                                 \/      16000      144000                    /    - --------------------------------- + --- + 2*3 /   - ----- + ------------           /           4000*      /    - --------------------------------- + --- + 2*3 /   - ----- + ------------                                                 \/      16000      144000                    /    - --------------------------------- + --- + 2*3 /   - ----- + ------------           /                                                       \/      16000      144000       4000*      /    - --------------------------------- + --- + 2*3 /   - ----- + ------------                  /                                                       \/      16000      144000       4000*      /    - --------------------------------- + --- + 2*3 /   - ----- + ------------            /    - --------------------------------- + --- + 2*3 /   - ----- + ------------
/                ________________________   400     \/      16000      144000             /                      /                ________________________   400     \/      16000      144000                                                                                                /                ________________________   400     \/      16000      144000             /                      /                ________________________   400     \/      16000      144000                                                                                                /                ________________________   400     \/      16000      144000             /                                                                                                  /                ________________________   400     \/      16000      144000                    /                                                                                                  /                ________________________   400     \/      16000      144000              /                ________________________   400     \/      16000      144000
/                /             __________                                                 /                      /                /             __________                                                                                                                                    /                /             __________                                                 /                      /                /             __________                                                                                                                                    /                /             __________                                                 /                                                                                                  /                /             __________                                                        /                                                                                                  /                /             __________                                                  /                /             __________
/                /     259    \/ 60325113                                                 /                      /                /     259    \/ 60325113                                                                                                                                    /                /     259    \/ 60325113                                                 /                      /                /     259    \/ 60325113                                                                                                                                    /                /     259    \/ 60325113                                                 /                                                                                                  /                /     259    \/ 60325113                                                        /                                                                                                  /                /     259    \/ 60325113                                                  /                /     259    \/ 60325113
/          300*3 /   - ----- + ------------                                               /                      /          300*3 /   - ----- + ------------                                                                                                                                  /          300*3 /   - ----- + ------------                                               /                      /          300*3 /   - ----- + ------------                                                                                                                                  /          300*3 /   - ----- + ------------                                               /                                                                                                  /          300*3 /   - ----- + ------------                                                      /                                                                                                  /          300*3 /   - ----- + ------------                                                /          300*3 /   - ----- + ------------
37   \/               \/      16000      144000                                                \/                     \/               \/      16000      144000                                                                                                                              37   \/               \/      16000      144000                                                \/                     \/               \/      16000      144000                                                                                                                              37   \/               \/      16000      144000                                                \/                                                                                                 \/               \/      16000      144000                                                  37   \/                                                                                                 \/               \/      16000      144000                                                 \/               \/      16000      144000
[- -- - --------------------------------------------------------------------------------------- - -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------, - -- - --------------------------------------------------------------------------------------- + -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------, - -- + --------------------------------------------------------------------------------------- + -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------, - -- - ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + ---------------------------------------------------------------------------------------]
40                                              2                                                                                                                                           2                                                                                                 40                                              2                                                                                                                                           2                                                                                                 40                                              2                                                                                                                                           2                                                                                                 40                                                                                                2                                                                                                                                           2
>>> solutions = solve(NPV)
>>> solutionsinlatex = [latex(solutions[i]) for i in range(4)]


The first solution is

$$- \frac{37}{40} - \frac{1}{2} \sqrt{- \frac{83}{300 \sqrt[3]{- \frac{259}{16000} + \frac{\sqrt{60325113}}{144000}}} + \frac{89}{400} + 2 \sqrt[3]{- \frac{259}{16000} + \frac{\sqrt{60325113}}{144000}}} - \frac{1}{2} \sqrt{- \frac{2787}{4000 \sqrt{- \frac{83}{300 \sqrt[3]{- \frac{259}{16000} + \frac{\sqrt{60325113}}{144000}}} + \frac{89}{400} + 2 \sqrt[3]{- \frac{259}{16000} + \frac{\sqrt{60325113}}{144000}}}} - 2 \sqrt[3]{- \frac{259}{16000} + \frac{\sqrt{60325113}}{144000}} + \frac{89}{200} + \frac{83}{300 \sqrt[3]{- \frac{259}{16000} + \frac{\sqrt{60325113}}{144000}}}}$$

The second solution is

$$- \frac{37}{40} - \frac{1}{2} \sqrt{- \frac{83}{300 \sqrt[3]{- \frac{259}{16000} + \frac{\sqrt{60325113}}{144000}}} + \frac{89}{400} + 2 \sqrt[3]{- \frac{259}{16000} + \frac{\sqrt{60325113}}{144000}}} + \frac{1}{2} \sqrt{- \frac{2787}{4000 \sqrt{- \frac{83}{300 \sqrt[3]{- \frac{259}{16000} + \frac{\sqrt{60325113}}{144000}}} + \frac{89}{400} + 2 \sqrt[3]{- \frac{259}{16000} + \frac{\sqrt{60325113}}{144000}}}} - 2 \sqrt[3]{- \frac{259}{16000} + \frac{\sqrt{60325113}}{144000}} + \frac{89}{200} + \frac{83}{300 \sqrt[3]{- \frac{259}{16000} + \frac{\sqrt{60325113}}{144000}}}}$$

The third solution is

$$- \frac{37}{40} + \frac{1}{2} \sqrt{- \frac{83}{300 \sqrt[3]{- \frac{259}{16000} + \frac{\sqrt{60325113}}{144000}}} + \frac{89}{400} + 2 \sqrt[3]{- \frac{259}{16000} + \frac{\sqrt{60325113}}{144000}}} + \frac{1}{2} \sqrt{- 2 \sqrt[3]{- \frac{259}{16000} + \frac{\sqrt{60325113}}{144000}} + \frac{89}{200} + \frac{83}{300 \sqrt[3]{- \frac{259}{16000} + \frac{\sqrt{60325113}}{144000}}} + \frac{2787}{4000 \sqrt{- \frac{83}{300 \sqrt[3]{- \frac{259}{16000} + \frac{\sqrt{60325113}}{144000}}} + \frac{89}{400} + 2 \sqrt[3]{- \frac{259}{16000} + \frac{\sqrt{60325113}}{144000}}}}}$$

The fourth solution is

$$- \frac{37}{40} - \frac{1}{2} \sqrt{- 2 \sqrt[3]{- \frac{259}{16000} + \frac{\sqrt{60325113}}{144000}} + \frac{89}{200} + \frac{83}{300 \sqrt[3]{- \frac{259}{16000} + \frac{\sqrt{60325113}}{144000}}} + \frac{2787}{4000 \sqrt{- \frac{83}{300 \sqrt[3]{- \frac{259}{16000} + \frac{\sqrt{60325113}}{144000}}} + \frac{89}{400} + 2 \sqrt[3]{- \frac{259}{16000} + \frac{\sqrt{60325113}}{144000}}}}} + \frac{1}{2} \sqrt{- \frac{83}{300 \sqrt[3]{- \frac{259}{16000} + \frac{\sqrt{60325113}}{144000}}} + \frac{89}{400} + 2 \sqrt[3]{- \frac{259}{16000} + \frac{\sqrt{60325113}}{144000}}}$$

Of these $4$ solutions, one is positive, one is negative, and two form a complex conjugate pair. The positive solution can be found numerically:

>>> nsolve(NPV,r,0.07)
0.108478871693288


Hence, $r \approx 11\%$.