How to find the multiplicative inverse of $$x^2+1 \pmod{x^4+x+1}$$
-
5Compute the Bezout factors $a(x)(x^2+1)+b(x)(x^4+x+1)=1$ using Euclid's algorithm. Then the class of $a(x)$ is the inverse of $x^2+1$ – conditionalMethod Dec 06 '19 at 16:34
-
1@Shubham, this is not meant to be a homework answer site, per se - we are happy to help, but please give context, or show what you tried and/or what you don't understand. – peter a g Dec 06 '19 at 16:37
-
A good start to get further help (and insight) would be to edit your question as to show us the gcd of $x^2+1$ and $x^4+x+1$, which you can compute using Euclid's algorithm. If you don't manage this, explain where you're stuck. – Olivier Roche Dec 06 '19 at 16:50
-
1Sorry, @peterag I was not asking it for my homework. I studied Galois field and was unable to calculate the multiplicative inverse. I want to know the approach not the solution – Shubham Kumar Dec 06 '19 at 16:52
-
1What have you tried? – David G. Stork Dec 06 '19 at 17:06
-
What is the prime field here? If $\Bbb{F}_2$ aka $GF(2)$, then you can look it up from a table of discrete logarithms I prepared for referrals like this. $x^2+1\equiv x^8$, so its inverse is $$x^7\equiv x^3+x+1.$$ Without telling the prime field, you leave us guessing. – Jyrki Lahtonen Dec 06 '19 at 21:46
3 Answers
If the field has characteristic 5 things change. This is over the rationals.
$$ \left( x^{4} + x + 1 \right) $$
$$ \left( x^{2} + 1 \right) $$
$$ \left( x^{4} + x + 1 \right) = \left( x^{2} + 1 \right) \cdot \color{magenta}{ \left( x^{2} - 1 \right) } + \left( x + 2 \right) $$ $$ \left( x^{2} + 1 \right) = \left( x + 2 \right) \cdot \color{magenta}{ \left( x - 2 \right) } + \left( 5 \right) $$ $$ \left( x + 2 \right) = \left( 5 \right) \cdot \color{magenta}{ \left( \frac{ x + 2 }{ 5 } \right) } + \left( 0 \right) $$ $$ \frac{ 0}{1} $$ $$ \frac{ 1}{0} $$ $$ \color{magenta}{ \left( x^{2} - 1 \right) } \Longrightarrow \Longrightarrow \frac{ \left( x^{2} - 1 \right) }{ \left( 1 \right) } $$ $$ \color{magenta}{ \left( x - 2 \right) } \Longrightarrow \Longrightarrow \frac{ \left( x^{3} - 2 x^{2} - x + 3 \right) }{ \left( x - 2 \right) } $$ $$ \color{magenta}{ \left( \frac{ x + 2 }{ 5 } \right) } \Longrightarrow \Longrightarrow \frac{ \left( \frac{ x^{4} + x + 1 }{ 5 } \right) }{ \left( \frac{ x^{2} + 1 }{ 5 } \right) } $$ $$ \left( x^{4} + x + 1 \right) \left( \frac{ x - 2 }{ 5 } \right) - \left( x^{2} + 1 \right) \left( \frac{ x^{3} - 2 x^{2} - x + 3 }{ 5 } \right) = \left( -1 \right) $$

- 139,541
All the fancy methods are fine, but here’s a back-alley way of doing it, strongly dependent on which field $\Bbb F$ your coefficients come from:
In the case the constants are from the field with two elements, then the field in which $x^2+1$ sits has $16=2^4$ elements, and its multiplicative group is cyclic of order $15$. This means that any nonzero element of the big field, say $z$, satisfies the condition that $z^{15}=1$, and consequently $z^{-1}=z^{14}$, which is easily calculated as $[((z^2)\cdot z)^2\cdot z]^2$, which you can do with only five multiplications in your field.

- 62,818
Easy by Inverse Reciprocity: $ $ first compute $\,\color{#0a0}{\large \frac{1}f} \,\bmod\, x^2\!+1,\,$ for $\, f = x^4\!+\!x\!+\!1,\,$ i.e.
$\!\!\bmod x^2\!+1\!:\ x\equiv i\,\Rightarrow\,\color{#0a0}{\dfrac{1}f}\equiv \dfrac{1}{i^4\!+\!i\!+\!1}\equiv \dfrac{1}{2+i}\equiv \color{#0a0}{\dfrac{2-i}5}\,$ by rationalizing denom
therefore $\ \color{#0a0}{\frac{1}5(2\!-\!x)}\, f = 1 + (x^2\!+\!1)\,\color{#c00}g,\ $ so
$\!\!\bmod f\!:\,\ \dfrac{1}{x^2\!+1}\equiv -\color{#c00}g\equiv \dfrac{1-\frac{1}5 (2\!-\!x) f}{x^2\!+1} \equiv {\large \frac{1}5}(x^3\!-2x^2\!-x+3)$

- 272,048
-
Note: the quotient can be calculated very quickly mentally as below
$$-5\color{#c00}g = \dfrac{(x!-!2)f+5}{x^2+1} = \dfrac{(x!-!2)(\color{#0a0}{x^4!-!1}+x!+!2)+5}{\color{#0a0}{x^2+1}} = (x!-!2)(\color{#0a0}{x^2!-!1})+1\qquad\qquad$$
– Bill Dubuque Nov 30 '23 at 03:05 -
Inverse reciprocity is a special case of the extended Euclidean algorithm. $\ \ $ – Bill Dubuque Nov 30 '23 at 03:06