A lot of websites have not explained this derivation well in terms of what is actually happening. I will attempt to simplify it by explaining each step carefully and give definitions which are important to know rather than jumping from one equation to another. I would recommend reading this at least two times in order to understand what is going on. Please feel free to comment below in case you have any doubts on this.