# How does one calculate the duration of a cash flow

The question reads: A firm has liabilities as follows: £2,910 at time t = 0 and £7,501 at time t = 4 (time is measured in years). On the asset side the firm has two payments, each for £5,000, at time t = 1 and t = 3. The annual effective rate is i = 5% p.a.

Compute the effective duration for both assets and liabilities.

I'm new to this topic and struggle to understand it. I understand duration to be a measure of the volatility of the present value of a cash flow with respect to changes in the interest rate. In order to calculate the duration I suppose I would use this formula:

$$v = -1/PV * dPV/di$$

I can calculate the present value of, let's say firstly, the liabilities to be:

PV = 2910 + $$(\frac{1}{1+i})^4$$7501 = 9081.09.

But where do I go from there? How would I use that value to calculate the duration? Thanks in advance.

Let's consider a single cash flow CF

$$PV = (\frac{1}{1+i})^n CF$$

As you wrote $$v = -\frac{1}{PV} \frac{d PV}{di}$$

Taking the derivative of PV with respect to i and plugging it in:

$$v= - \frac{(1+i)^n}{CF} n \frac{1}{(1+i)^{n-1}}\frac{-1}{(1+i)^2}CF$$

after simplifying we get

$$v = \frac{1}{1+i}n$$

(which is easy to remember, no need to derive it every time)

So v = (1/1.05)4 = 3.809.

Now consider multiple cash flows. The duration then is the weighted average of the durations, using the PVs as weights.

So on the liability side we have 1 cash flow with duration 0 and PV 2910, and one cash flow with duration 3.809 and PV 6171.09. The combined PV is 9081.09. The combined duration of the liabilities is 0+3.809*6171.09/9081.09 = 2.588