Update derivation to include cosine transform