For one thing, trying to do something that you don't fully understand is a bad idea.
Second, he refers to arrays as vectors, which are two completely different objects.
Third, all concepts of modular and object oriented programming are ignored.
Fourth, and I just realized this, the formula is incorrect, and only works when yaw = pitch.