Simplification process with exponent in a polynomial function input During the factorization process from the point of view of a function, I have difficulty to see where some part gets converted.
Assuming we have the function 
$$f(x)=2x^2+3x-1$$
When I want to evaluate as...
$$f(a+h)$$
Taken from my course textbook outlining this process to replace all $x$ to $a+h$.
The simplification procedure seems unclear to me:
$$f(a+h) = 2(a+h)^2+3(a+h)-1$$
$$f(a+h) = 2(a^2+2ah+h^2)+3(a+h)-1$$
$$f(a+h) = 2a^2+4ah+2h^2+3a+3h-1$$
The second line where Mostly when ... $2ah$ ... gets me confused. 
What could be the explanation?
 A: Let's change letters. We want to show that
$$(x+y)^2=x^2+2xy+y^2.$$
With these changed letters the result may already be familiar to you. But if you want algebraic details,
$$(x+y)^2=(x+y)(x+y)=x(x+y)+y(x+y)=x^2+xy+yx+y^2=x^2+2xy+y^2.$$
A: 
The second line here is very confusing for me. Mostly when 2ah.

I am assuming you want to know where did the 2ah come from. The diagram below is meant to show how we computer $(a+h)(a+h)$ and where did the $2ah$ came from. Each arrow is labeled with a number. There are 4 multiplications required. Each multiplication's result is show besides the arrow number.
I hope this helps.

A: We have,$$f(a + h) =2(a + h)^2 + 3(a + h) -1  $$Most students confuse $2(a + h)^2  $ with $(2a + 2h)^2 $, and I hope that is not the case with you. Remember that $2(a + h)^2 $ is actually $2 \times (a + h)^2 $ and you have to simplify the exponent before multiplying according to order of operations.
Simplifying $(a + h)^2 $ again, is an elementary process involving intuition and distributive property. Continuing,$$\begin{align}(a + h)^2 & = &(a + h)(a +h) \\  & = & a(a + h) + h(a + h)\\& = &a^2 + ah + ah + h^2\\ & = &a^2 + 2ah + h^2 \end{align} $$Coming back, we had $2(a + h)^2 $ which simplifies to $2(a^2 + 2ah + h^2) $ or $2a^2 + 4ah + 2h^2  $. For completing the answer, you have to add $3(a + h)$ to $2a^2 + 4ah + 2h^2 $ and subtract $1 $ from the result. Note that $3(a + h) = 3a + 3h $.
