# Thread: Maximum value of 12 variable function to get highest bank interest rate

1. ## Maximum value of 12 variable function to get highest bank interest rate

Background: A bank offers regular saving product whereby a sum of money is deposited monthly for a period of 12 months after which you receive interest on this money. The 12 deposits must be between £25 and £300. The interest rate is 5%.

However, if you choose to invest the full 12 x £300 = £3600, you obviously do not get 5% of £3600 because the whole amount is not invested for one year. It is 5%/12 of £300 for month 1, 5%/12 of £600 + [month 1 interest] for month 2, etc. At the end of the year you would make £99.01 equating to 2.75% of £3600 invested.

Using Excel I have found that investing £300 for the first 3 months and then the minimum £25 for the final 9 will give you £46.87 return on £1125 which is a much better 4.17%.

I attach the spreadsheet for you to see my results/hopefully give a clearer picture of what I am looking into.

This more useful interest rate can be calculated as a function of 12 variables (each monthly payment) with certain parameters. The function being:

$
I = \frac{InterestEarned}{AmountInvested} = \frac{TotalAfter12Months - AmountInvested}{AmountInvested}
$

$
I = \frac{(R^{12}x_1 + R^{11}x_2 + ... + R^2x_{11} + Rx_{12}) - \sum_{i=1}^{12} x_i}{\sum_{i=1}^{12} x_i}
$

where $25 \leq x_1,...,x_{12} \leq 300$ (monthly payments), and $R = 1+\frac{0.05}{12}$ (the 5% interest applied each month)
and I = the actual percentage of the total amount invested at the end of the year which I am seeking to maximise.
(If it isn't clear how I arrived with this formula please ask or derive yourself!)

The question: is there a method for finding the best possible values for x1...x12 to make 'I' as large as possible.

Whilst I have found the best values in this case by trial and error in the spreadsheet, I am left wondering why it works out best to put in 300 for just the first 3 months, why not 2, why not 4. If there is a nice explanation that does not involve using the above function then I would appreciate that too. Just something so I can see why it works out this way.

It will also benefit to have a general method for finding the best options where the limits, interest rates and frequency of investment are different.

Many thanks for any assistance. It is nice using maths to help save money better

2. Haven't looked at your xls or anything but it appears this is really just an optimization problem. What you need to determine is whether your interest function is convex or concave. Knowing this, once you find a stationary point, youre done. That is, defining
$I(x) = \frac{(R^{12}x_1 + R^{11}x_2 + ... + R^2x_{11} + Rx_{12}) - \sum_{i=1}^{12} x_i}{\sum_{i=1}^{12} x_i}$, you want to first find a point so that
$I'(\tilde{x}) = 0 \forall i=1,2,..12$
Then you want to compute the determinant of the Hessian matrix of I at $\tilde{x}$ where the Hessian is defined as:

Then you need to study the $n$ determinants (leading principal minors) of this matrix.
So compute
$D_{k}(\tilde{x})$=

$\begin{bmatrix}
{I}_{11}^{''}&{I}_{12}^{''}&...{I}_{1k}^{''}\\
{I}_{21}^{''}&{I}_{22}^{''}&...{I}_{2k}^{''} \\
.&.&.\\
.&.&.\\
.&.&.\\
{I}_{k1}^{''}&{I}_{k2}^{''}&...{I}_{kk}^{''}\end{b matrix}
$

for ( $k=1,...,12$)

Then check the following:
(a) if $(-1)^kD(\tilde{x})>0, k=1,...,12 \Rightarrow \tilde{x}$is local maximum.

Any local maximum of a convex function is also global maximum.

To test for convexity check whether the Hessian H(x) is positive semidefinite $\forall$x.