We present a method to derive an analytical expression for the roughness of an eroded surface whose dynamics are ruled by cellular automaton. Starting from the automaton, we obtain the time evolution of the height average and height variance (roughness). We apply this method to the etching model in 1+1 dimensions, and then we obtain the roughness exponent. Using this in conjunction with the Galilean invariance we obtain the other exponents, which perfectly match the numerical results obtained from simulations. These exponents are exact, and they are the same as those exhibited by the Kardar-Parisi-Zhang (KPZ) model for this dimension. Therefore, our results provide proof for the conjecture that the etching and KPZ models belong to the same universality class. Moreover, the method is general, and it can be applied to other cellular automata models.