Computing derivatives of linear functions