Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Multiplicative inverse of a polynomial

  • 13-07-2008 07:56PM
    #1
    Closed Accounts Posts: 12,382 ✭✭✭✭


    Hello

    I know this is kind of a maths question, but I am trying to code the multiplicative inverse of a polynomial.

    Quick explanation -

    Let's say you want to divide a by b, i.e. a / b. Instead of using division, you can find the multiplicative inverse of b and multiply instead.

    For example:

    a = 20
    b = 5

    a / b = 20 / 5 = 4
    or
    a * (inverse b) = 20 * (inverse b) = 4
    a * (inverse b) = 20 * 1/5 = 4

    So as you can see, the inverse of b is simply changing 5/1 to 1/5.

    This is straightforward.

    Now let's have a polynomial example:

    a = x^2
    b = x

    a / b = x^2 / x = x
    or
    a * (inverse b) = x^2 * (inverse b) = x
    a * (inverse b) = x^2 * 1/x = x

    Again, this is fairly straightforward.

    But what if a and b are more complicated?

    For example:

    a = x^7 + x^5 + x + 1
    b = x^6 + x^2 + x

    a / b = x^7 + x^5 + x + 1 / x^6 + x^2 + x = 1 remainder x^5 + x^2 + x
    a * (inverse b) = x^7 + x^5 + x + 1 * (inverse b) = 1 remainder x^5 + x^2 + x

    How can I figure out the inverse of b?!

    Any help greatly appreciated!

    Thanks

    PS I know the Extended Euclidean Algorithm and "Repeated Square and multiply" can be used, but I'm yet to come across an example which uses polynomials. I have no problem getting the multiplicative inverse of a natural number.


Comments

Advertisement