Simplifying Polynomials using Formulas

Am doing an 8th grade math text book, and I came across this one:

If $h(y) = y^2$, and $g(z) = z^3$, HCF of $h(b) - h(a)$ and $g(b) - g(a) =$ ?

I got to know $h = y$ and $g = z^2$, but couldn't do anything with it. So I had to see the answer; but it was like:

$h(b) - h(a) = b^2 - a^2$; and $g(b) - g(a) = b^3 - a^3$.

How is this possible; and is there any other method to solve this; or is there a mistake in the answer?

Note that $h(y)$ does not mean $h$ multiplied by $y$. It means that $h$ is a function of the variable $y$. The equation $h(y)= y^2$ means that, given $y$, applying the function $h$ has the effect of squaring the input (namely, $y$). With this in mind, $h(a) = a^2$ (the function $h$ squares the input) and $h(b) = b^2$ so $h(b) - h(a) = b^2 - a^2$.
Not sure what you do not see. I will assume that you realize that $h(b)-h(a) = b^2-a^2$. I will give some details in a bit.
Now $$h(b)-h(a)=b^2-a^2 = (b-a)(b+a)$$ $$g(b)-g(a)=b^3-a^3 = (b-a)(b^2 + ab + a^2)$$ So HCF is $b-a$ as it is a common factor.
If you don't see why $h(b)-h(a)=b^2-a^2$ here is a brief explanation.
Think of a function as a grinder. If you put in coffee beans, you get coffee powder. If you put black beans you get black beans powder etc. Now $h$, viewed this way, says, put $y$ in and out comes $y^2$. So if you put $b$ in, you get $b^2$ etc.