How to analyse risk mathematically