ok first Remember ,
Miss Time = Miss Penalty + Hit Time
here three main formula all are same
AMAT = hit time +miss rate * miss penalty
AMAT = Hit ratio * hit time + (1-hit time)* miss time
AMAT = H (Tc) + (1-H)(Tc + Tm)
where
H =hit ratio
Tc = cache access time
Tm = miss penalty
In the given question it directly mention the miss time, means Miss penalty+Hit time = 50 nsec
by putting this values in given formula 1
Miss penalty = 50 - hit time = 50 - 5 = 45
AMAT = 5 + (1 - 0.8)*45 = 5+ 9 = 14 ns
by formula 2
AMAT = 0.8 * 5 + ( 1- 0.8 ) * 50 = 4 + 10 = 14ns
by formula 3
Tc= 5 ns
Tm = Miss Penalty = 45
ATMT = 0.8 * 5 + (1 - 0.8 )(5 + 45) = 14 ns