a) \(\left(\frac{1}{2}x+y\right)\left(\frac{1}{2}x+y\right)\)
\(=\frac{1}{2}x.\left(\frac{1}{2}x+y\right)+y.\left(\frac{1}{2}x+y\right)\)
\(=\frac{1}{4}x^2+\frac{1}{2}xy+\frac{1}{2}xy+y^2\)
\(=\frac{1}{4}x^2+xy+y^2\)
b) \(\left(x^3-2x^2+x\right).\left(5-x\right)\)
\(=x^3.\left(5-x\right)-2x^2.\left(5-x\right)+x.\left(5-x\right)\)
\(=5x^3-x^4-10x^2+2x^3+5x-x^2\)
\(=7x^3-x^4-11x^2+5x\)