Procedures to measure Error Voltage Magnitude on digital communications signals are given in many papers and standards with slight differences. EVM is implemented in measurement equipment used by communication devices manufacturers. EVM will be even more important in 5G devices and network. A rigorous mathematical definition of EVM will be proposed. From this definition, an optimum algorithm is derived to replace the procedures, and the main errors and biases are computed. Some typical errors coming from erroneous interpretation of definitions or from sub-optimum algorithm implementation will be presented. Noise Power Ratio is defined with the same formal definition, only applied to a different RF signal such as a band limited additive white Gaussian noise. Examples of IQ imbalance, linear and non-linear distortions and noise addition will be presented.