Let us consider

- The miss rate of L2 cache as M
- So the hit rate of L2 would be 1 - M

As per question, Miss rate of L1 is **twice** that of L2,

So,

- Miss rate of L1 would be 2M
- Hence its hit rate would be 1 - 2M

Now, to access anything,

- We would first go to L1
- If it is a L1 hit, then return ==> L1 access time
- If it is a L1 miss, then we would go to L2 ==> L1 access time* + L2 access time
- If it is a L2 hit, then return ==> L2 access time
- If it is a L2 miss, then we would go to memory and return ==> L2 access time** + Memory access time

*In case of a miss also, we would include L1 access time, because only after accessing L1, we would come to know that element is now there in L1

**In case of a miss also, we would include L2 access time, because only after accessing L2, we would come to know that element is now there in L2

So, average time to access memory would be

(L1 hit rate) x (Time to access L1) +
(L1 miss rate) x [ Time to access L1 +
(L2 hit rate) x (Time to access L2) +
(L2 miss rate) x [(Time to access L2) + (Time to access memory)]
]

As per question,

- Time to access L1 = 1 cycle
- Time to access L2 = 8 cycles
- Time to access memory = 18 cycles

And our assumption

- L1 hit rate = 1 - miss rate = 1 - 2M
- L1 miss rate = 2M
- L2 hit rate = 1 - miss rate = 1 - M
- L2 miss rate = M

Putting these values in above equation:

(1 - 2M) x (1) + (2M) x [ 1 + (1 - M) x (8) + (M) x [(8) + (18) ]]
1 - 2M + 2M [ 1 + 8 - 8M + M (26) ]
1 - 2M + 2M[ 9 -7M + 26M]
1 - 2M + 2M [ 18M + 9]
1 - 2M + 36M^2 + 18M
36M^2 + 16M + 1 = Average time to access memory

Given that Average time to access memory is 2 cycles

36M^2 + 16M + 1 = 2
36M^2 + 16M - 1 = 0
On Solving, M = 0.05555555 ==> 0.056 Approx

So, **miss rate for L1** ==> 2M ==> 2 x 0.055555 = **0.1111**

So, **miss rate for L2** ==> M ==> 0.055555 which is approx **0.056**