The Mathematics of Managing Risk