Yes. Assume $\rm\ \ h_1 = (a^2 c_1 + a c_2 + c_3\ mod\ a)\ $
then $\rm\: mod\ a\!:\:$ $\rm\: h_1 \equiv a^2 c_1 + a c_2 + c_3\:$
thus $\rm\ \ \ a c_2 + c_3\equiv h_1 - a^2 c_1\:$
thus $\rm\ \ \ a(a c_2 + c_2) + c_4 \equiv a ( h_1 - a^2 c_1) + c_4$
thus $\rm\ \ \ ((a c_2 + c_2) + c_4\ mod\ a) = (( h_1 - a^2 c_1) + c_4\ mod\ a)$
Generally, as here, it is inconvenient to perform arithmetic using only normal forms (such as least equivalence class reps). Instead, convert to general equivalence classes, use general modular arithmetic and, if need be, convert back to normal forms reps only at the end of the computation. For example, to compute $\rm\:1/2\:\ mod\:\ 2n\!+\!1\:$ it is easier to choose any even rep of $1,\:$ for example $\rm\:2n\!+\!2\equiv 1,\:$ hence $\rm\:1/2\equiv (2n\!+\!2)/2\equiv n\!+\!1.$
This is familiar from fraction arithmetic. It'd be inconvenient to have to do all fraction arithmetic only with fractions in normal form (= lowest terms). For example, when adding fractions it is convenient to scale them to have a common denominator, then do the addition on these non-lowest term fractions, then, if need be, normalize the result to lowest terms.
The reason that equivalence class arithmetic proves smoother is that congruence mod m is not only an equivalence relation but is, additionally, an arithmetic congruence relation, i.e. it respects the arithmetic operations. This implies that all of the integer arithmetic laws (ring structure) are preserved in modular arithmetic. Thus we can apply all of our well-honed arithmetical intuition when performing congruence arithmetic, e.g. using identities such as the binomial theorem, differences of squares factorization, etc.
%
, or Python-style%
, which behave differently for negative numbers? – Dan May 19 '12 at 21:51