(color(red)(2x)+colkor(blue)(1))(x+2)
color(white)("XXXX")= color(red)(2x)(x+2) + color(blue)(1)(x+2)
color(white)("XXXX")= color(red)(2x^2+4x) + color(blue)(x + 2)
color(white)("XXXX")= 2x^2+5x+2
The following provides an even more detailed version of this, which you should ignore if the above made sense to you.
In general color(green)((a+b)*(c) = (a*c) + (b*c)color(white)("XXXX")(Distributive property)
Letting color(green)(a)=2x and color(green)(b)=1 and color(green)(c)=(x+2)
we have:
color(white)("XXXX")(2x+1)(x+2) = color(red)(2x(x+2)) + color(blue)(1(x+2))
Also, in general, color(orange)((p)*(q+r) = (p*q)+(p*r))color(white)("XXXX")(Distributive property, again)
First letting color(orange)(p) = 2x and color(orange)(q)=x and color(orange)(r)=2
we have:
color(white)("XXXX")color(red)(2x(x+2) = 2x*x + 2x*2)
which simplifies as:
color(white)("XXXX")color(white)("XXXX")color(red)(= 2x^2 +4x)
Then letting color(orange)(p)=1 and color(orange)(q)=x and color(orange)(r)=2
we have:
color(white)("XXXX")color(blue)(1(+2) =1*x + 1*2)
which simplifies as:
color(white)("XXXX")color(white)("XXXX")color(blue)(= x + 2)
So
(2x+1)(x+2) = color(red)(2x^2+4x) + color(blue)(x+2)
color(white)("XXXX")color(white)("XXXX")= 2x^2 + 5x +2