Simple polynomial division question

• Jul 20th 2008, 10:16 AM
MrSteve
Simple polynomial division question
Hello

I hope someone can help me with this.

Let's say I want to divide x^2 + x + 1 into x^2 + 1

Am I right in thinking the answer is 1 remainder x?

This is how I am getting my answer...

I convert my polynomials into binary -

x^2 + x + 1 = 111
x^2 + 1 = 101

Then I do long division -

Code:

1
111 / 101
111
----
010

Which translates as 1 remainder x.

Am I correct?

If so, how would I handle x^4 + 1 into x^2 + 1?

Convert to binary -

10001 / 101

Am I right in thinking the answer is -

Code:

0
10001 / 101
000
----
101

So the answer is 0 remainder x^2 + 1?

Thank you.
• Jul 20th 2008, 08:12 PM
mr fantastic
Quote:

Originally Posted by MrSteve
Hello

I hope someone can help me with this.

Let's say I want to divide x^2 + x + 1 into x^2 + 1

Am I right in thinking the answer is 1 remainder x?

This is how I am getting my answer...

I convert my polynomials into binary -

x^2 + x + 1 = 111
x^2 + 1 = 101

Then I do long division -

Code:

1
111 / 101
111
----
010

Which translates as 1 remainder x.

Am I correct?

If so, how would I handle x^4 + 1 into x^2 + 1?

Convert to binary -

10001 / 101

Am I right in thinking the answer is -

Code:

0
10001 / 101
000
----
101

So the answer is 0 remainder x^2 + 1?

Thank you.

Your method will work, I think, when the coefficients of both polynomials are either zero or one.
• Jul 21st 2008, 05:53 AM
tutor
Hi,

the first part what u did it is correct.

for the second part that is when x^4+1 divided by x^2+1
the remainder will be -x^2+1 and quotient is x^2.
• Jul 21st 2008, 09:46 AM
MrSteve
Quote:

Originally Posted by tutor
for the second part that is when x^4+1 divided by x^2+1
the remainder will be -x^2+1 and quotient is x^2.

Hello

I am not too worried about it being -x^2 + 1 or x^2 + 1 (in my code, whether I XOR a minus or a plus, the answer is the same), but I do not understand why the coefficient is x^2.

I am dividing x^2 + 1 by x^4 + 1. Do you think I am doing it the other way round?

Thanks
• Jul 23rd 2008, 05:19 PM
mr fantastic
Quote:

Originally Posted by tutor
Hi,

the first part what u did it is correct.

for the second part that is when x^4+1 divided by x^2+1
the remainder will be -x^2+1 and quotient is x^2.

The original question says into, not by .....