# Is this composition of polynomial correct?

Suppose $p(x)=x^2+5x+3$ and $q(x)=3x^3-3x+7$. Write the expression $(q \circ p)(x)$ as a sum of terms, each which is a constant times the power of $x$.

Here is my work for the problem:
$(q\circ p)(x)=3(x^2+5x+3)^3-3(x^2+5x+3)+7$
$(q\circ p)(x)=3(x^6+125x^3+27)-3x^2-15x-9+7$
$(q\circ p)(x)=3x^6+375x^3+81-3x^2-15x-2$
$(q\circ p)(x)=3x^6+375x^3-3x^2-15x+79$

Did I do something wrong while working with this problem? The final answer I got wasn't in the multiple choice answers. I went over this problem 3 times and cannot find what I am doing wrong.

-

Your understanding of composition is fine; it’s just your algebra that went astray. See @Jasper’s answer. – Brian M. Scott Sep 27 '12 at 20:42

## 2 Answers

The mistake you made is assuming that $(a+b+c)^3=a^3+b^3+c^3$. Note that $(a+b+c)(a+b+c)=a^2+ab+ac+ba+b^2+bc+ca+cb+c^2$. Simplify and multiply by $a+b+c$ again to get the cube. Alternatively you can rewrite $q(x)=3x(x^2-1)+7$ and work from there.

-

Is there a shortcut to multiply this out? I did $(a+b+c)^2$ first then multiplied that by $(a+b+c)$ again. It was very long and messy. – Steven N Sep 27 '12 at 20:45
@Steven This is a common (and very important) fallacy to overcome! Powers do not "distribute" over + or -... try to unlearn this misconception! – rschwieb Sep 27 '12 at 20:45

As Jasper noted you did wrong here: $$...=3(x^2+5x+3)^3...$$ $$...=3(x^6+125x^3+27)-...$$ In fact $$(a+b+c)^3=a^3 + 3a^2b + 3a^2c + 3ab^2 + 6abc + 3ac^2 + b^3 + 3b^2c + 3bc^2 + c^3$$ we have $q(p(x))=3x^6+45x^5+252x^4+645x^3+753x^2+390x+79$

-
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 15, "mathjax_display_tex": 3, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.956359326839447, "perplexity_flag": "middle"}