a)\(a^2+6a+8-b^2-2b=\left(a+3\right)^2-\left(b+1\right)^2=\left(a+3+b+1\right)\left(a+3-b-1\right)\)
\(=\left(a+b+4\right)\left(a-b+2\right)\)
b)\(a^2+6ax+8x^2-b^2-2bx\)
\(=\left(a+3x\right)^2-\left(b+x\right)^2\)
\(=\left(a+3x-b-x\right)\left(a+3x+b+x\right)=\left(a-b+2x\right)\left(a+b+4x\right)\)