Documentation

# polynomialReduce

Reduce polynomials by division

## Syntax

``r = polynomialReduce(p,d)``
``r = polynomialReduce(p,d,vars)``
``r = polynomialReduce(___,'MonomialOrder',MonomialOrder)``
``[r,q] = polynomialReduce(___)``

## Description

example

````r = polynomialReduce(p,d)` returns the Polynomial Reduction of `p` by `d` with respect to all variables in `p` determined by `symvar`. The input `d` can be a vector of polynomials.```

example

````r = polynomialReduce(p,d,vars)` uses the polynomial variables in `vars`.```

example

````r = polynomialReduce(___,'MonomialOrder',MonomialOrder)` also uses the specified monomial order in addition to the input arguments in previous syntaxes. Options are `'degreeInverseLexicographic'`, `'degreeLexicographic'`, or `'lexicographic'`. By default, `polynomialReduce` uses `'degreeInverseLexicographic'`.```

example

````[r,q] = polynomialReduce(___)` also returns the quotient in `q`.```

## Examples

collapse all

Find the quotient and remainder when ```x^3 - x*y^2 + 1``` is divided by `x + y`.

```syms x y p = x^3 - x*y^2 + 1; d = x + y; [r,q] = polynomialReduce(p,d)```
```r = 1 q = x^2 - y*x```

Reconstruct the original polynomial from the quotient and remainder. Check that the reconstructed polynomial equals `p` by using `isAlways`.

```pOrig = expand(sum(q.*d) + r); isAlways(p == pOrig)```
```ans = logical 1```

Specify the polynomial variables as the second argument of `polynomialReduce`.

Divide `exp(a)*x^2 + 2*x*y + 1` by ```x - y``` with the polynomial variables `[x y]`, treating `a` as a symbolic parameter.

```syms a x y p = exp(a)*x^2 + 2*x*y + 1; d = x - y; vars = [x y]; r = polynomialReduce(p,d,vars)```
```r = (exp(a) + 2)*y^2 + 1```

Reduce `x^5 - x*y^6 - x*y` by ```x^2 + y``` and `x^2 - y^3`.

```syms x y p = x^5 - x*y^6 - x*y; d = [x^2 + y, x^2 - y^3]; [r,q] = polynomialReduce(p,d)```
```r = -x*y q = [ x^3 - x*y^3, x*y^3 - x*y]```

Reconstruct the original polynomial from the quotient and remainder. Check that the reconstructed polynomial equals `p` by using `isAlways`.

```pOrig = expand(q*d.' + r); isAlways(p == pOrig)```
```ans = logical 1```

By default, `polynomialReduce` orders the terms in the polynomials with the term order `degreeInverseLexicographic`. Change the term order to `lexicographic` or `degreeLexicographic` by using the `'MonomialOrder'` name-value pair argument.

Divide two polynomials by using the `lexicographic` term order.

```syms x y p = x^2 + y^3 + 1; d = x - y^2; r = polynomialReduce(p,d,'MonomialOrder','lexicographic')```
```r = y^4 + y^3 + 1```

Divide the same polynomials by using the `degreeLexicographic` term order.

`r = polynomialReduce(p,d,'MonomialOrder','degreeLexicographic')`
```r = x^2 + y*x + 1```

## Input Arguments

collapse all

Polynomial to divide, specified as a symbolic expression or function.

Polynomials to divide by, specified as a symbolic expression or function or a vector of symbolic expressions or functions.

Polynomial variables, specified as a vector of symbolic variables.

Monomial order of divisors, specified as `'degreeInverseLexicographic'`, `'degreeLexicographic'`, or `'lexicographic'`. If you specify `vars`, then `polynomialReduce` sorts variables based on the order of variables in `vars`.

• `lexicographic` sorts the terms of a polynomial using lexicographic ordering.

• `degreeLexicographic` sorts the terms of a polynomial according to the total degree of each term. If terms have equal total degrees, `polynomialReduce` sorts the terms using lexicographic ordering.

• `degreeInverseLexicographic` sorts the terms of a polynomial according to the total degree of each term. If terms have equal total degrees, `polynomialReduce` sorts the terms using inverse lexicographic ordering.

## Output Arguments

collapse all

Remainder of polynomial division, returned as a symbolic polynomial.

Quotient of polynomial division, returned as a symbolic polynomial or a vector of symbolic polynomials.

collapse all

### Polynomial Reduction

Polynomial reduction is the division of the polynomial p by the divisor polynomials d1, d2, …, dn . The terms of the divisor polynomials are ordered according to a certain term order. The quotients q1, q2, …, qn and the remainder r satisfy this equation.

`$p={q}_{1}{d}_{1}+{q}_{2}{d}_{2}+\dots +{q}_{n}{d}_{n}+r.$`

No term in r can be divided by the leading terms of any of the divisors d1, d2, …, dn .