Finished derivation of working equation