solve
<a href="http://www.codecogs.com/eqnedit.php?latex=27{&space;x&space;}^{&space;6&space;}-27{&space;x&space;}^{&space;4&space;}+6{&space;x&space;}^{&space;2&space;}+2=\left(&space;3x^{&space;2&space;}+2ax+b&space;\right)&space;^{&space;3&space;}+a\left(&space;3x^{&space;2&space;}+2ax+b&space;\right)&space;^{&space;2&space;}+b\left(&space;3x^{&space;2&space;}+2ax+b&space;\right)&space;+c" target="_blank"><img src="http://latex.codecogs.com/gif.latex?27{&space;x&space;}^{&space;6&space;}-27{&space;x&space;}^{&space;4&space;}+6{&space;x&space;}^{&space;2&space;}+2=\left(&space;3x^{&space;2&space;}+2ax+b&space;\right)&space;^{&space;3&space;}+a\left(&space;3x^{&space;2&space;}+2ax+b&space;\right)&space;^{&space;2&space;}+b\left(&space;3x^{&space;2&space;}+2ax+b&space;\right)&space;+c" title="27{ x }^{ 6 }-27{ x }^{ 4 }+6{ x }^{ 2 }+2=\left( 3x^{ 2 }+2ax+b \right) ^{ 3 }+a\left( 3x^{ 2 }+2ax+b \right) ^{ 2 }+b\left( 3x^{ 2 }+2ax+b \right) +c" /></a>
for P(x)=x^3+ax^2+bx+c
by inspection or otherwise, one can deduce that a=0, b=-1, c=2 suffices the equation
therefore P(x)=x^3-x+2