Source: https://web.ece.ucsb.edu/~hespanha/ece229/Lectures/Lecture4.pdf