First let's start by analysing e.

Since e is the root of `x^2+x+1=0`

then `e=(-1+-sqrt(1-4))/2=(-1+-isqrt(3))/2=-1/2+-isqrt(3)/2`

So our answer will depend on the value we are using.

If `e=-1/2-isqrt(3)/2 => e^2=1/4+(2isqrt(3))/4+(i^2*3)/4 =>`

`e^2=1/4+isqrt(3)/2-3/4 => e^2=-1/2+isqrt(3)/2`

Similarly if you square `e=-1/2+isqrt(3)/2`

you will get `e^2=-1/2-isqrt(3)/2`

Note that squaring one of the root is giving us the 2nd one, which means if we take to the 4th power it is going to be equal itself.

Let's see what happens if we cube e. Note that regardless of which root we use, the following computation won't change.

`e^3=e^2*e=(-1/2-isqrt(3)/2)(-1/2+isqrt(3)/2) =>`

`e^3=1/4-i^2*3/4=1/4+3/4=1`

Now let's foil the given expression.

`(ae^2+be)(be^2+ae)=`

`abe^4+a^2e^3+b^2e^3+abe^2=`

`abe^4+(a^2+b^2)e^3+abe^2`

` `

If we decide to use the first value for e, then `e^2`

will be equal to the 2nd one but `e^4` will be itself. So since both and are multiplied by ab, whatever root we choose the the following computation will be the same.

`ab(-1/2-isqrt(3)/2)+(a^2+b^2)+ab(-1/2+isqrt(3)/2)=`

`(-ab)/2+(-abisqrt(3))/2+a^2+b^2+(-ab)/2+(abisqrt(3))/2=`

`-ab+a^2+b^2`

Hope this was helpful.