# How to decompose function like x^2+x-6?

I was trying to wrap my brain around this but could not think of anything. I am very poor at maths but trying to learn of it.

Edit: Exact question is If x^2+x-6 is a composite function f(g(x)); then figure out f(x) and g(x) ?

To me information looks incomplete to figure out such details.

-
I suppose you mean, how to factor the polynomial? – Adrián Barquero Nov 23 '10 at 23:45
high school algebra $\neq$ linear-algebra. retagged as polynomials. – Willie Wong Nov 23 '10 at 23:52
Hmm well that changes things a little bit. But now your problem does not have a unique solution. – Adrián Barquero Nov 23 '10 at 23:58
There are potentially many ways of doing this in general. For e.g. take $f(x)=x-6$ and $g(x)=x^2+x$. – Timothy Wagner Nov 24 '10 at 0:08
It may be awfully cheap, but consider $f(x)=x^2+x-6$, and $g(x)=x$. Then $f(g(x))=f(x)=x^2+x-6$. – yunone Nov 24 '10 at 0:13

We always have

(x+a)(x+b) = (x(x+b))+(a*(x+b)) = (x*x)+(x*b)+(a*x)+(a*b) = (x^2)+(b*x)+(a*x)+(a*b) (x^2)+(b*x)+(a*x)+(a*b) = (x^2)+(a*x)+(b*x)+(a*b) = (x^2)+((a+b)*x)+(a*b) (x+a)*(x+b) = (x^2)+((a+b)*x)+(a*b)

Converting your equation to that form gives

x^2+x-6 = (x^2)+(1*x)+(-6)

where we want

(x^2)+(1*x)+(-6) = (x^2)+((a+b)*x)+(a*b)

So, we're looking for numbers whose sum is 1 and whose product is -6.

a+b = 1 and a*b = -6

That should be enough for you to figure it out, but in case it's not,
if you just want the answer you can put

"n vf rdhny gb artngvir gjb naq o vf rdhny gb cbfvgvir guerr"

into rot13.com

-
You've misread the question. – Qiaochu Yuan Nov 24 '10 at 0:20
@Qiaochu: I'd be more generous and assume he missed the update (the question was updated while Ricky was posting the answer). Two minutes isn't that long a gap. – J. M. Nov 24 '10 at 0:29

The 'simplest' possibility is f(x) := x-3 and g(x) := x^2+x-3.

It is the more natural of the 2 pairs of integer polynomials of degree at most 2 that minimize the sum of squares of their coefficients while composing to give x^2+x-6.

...

and apparently it's not this easy to get back the account I created on another computer.

-

The context of this question suggests that $f=f(x)$ and $g=g(x)$ are going to be polynomials (with either real, rational or integer coefficients). If this is the case then...

Hint: While there's going to be an infinite number of functions $f,g$ for which $f(g(x))=x^2+x-6$, there will only be two situations when this can occur (consider the degrees of $f$ and $g$, and how that effects $f(g(x))$). These can be classified by setting $f$ and $g$ as arbitrary polynomials of the appropriate degrees, composing them, then equating coefficients with $f(g(x))=x^2+x-6$.

If $f$ and $g$ are not restricted to polynomials, there's going to be all sorts of functions $f$ and $g$ for which $f(g(x))=x^2+x-6$. For example: Let $A=\left(\begin{matrix}-2 & 1 \\ 4 & 1 \end{matrix}\right)$. Then the characteristic polynomial $\det(A-xI)=(-2-x)(1-x)-4=x^2+x-6$.

-

Since I don't think anyone else has covered it and because it can be useful for thinking about inverse functions/relations, consider completing the square: \begin{align} f(x)&=x^2+x-6 \\ &=x^2+x+\frac{1}{4}-\frac{25}{4} \\ &=\left(x+\frac{1}{2}\right)^2-\frac{25}{4} \end{align} so $f(x)=a(b(c(x)))$ where $a(x)=x-\frac{25}{4}$, $b(x)=x^2$, and $c(x)=x+\frac{1}{2}$. The advantage here (though probably not significant for your purpose) is that each of these functions can be thought of as a single simple operation on their input (that the input appears only once in each function also makes it easier to think of this way).

-