# Coefficients of a polynomial: coeff coeffs

### 5.27.7 Coefficients of a polynomial: coeff coeffs

The coeff command finds the coefficients of a specific degree of a polynomial.
coeffs is a synonym for coeff.

- coeff takes two mandatory and one optional argument:
  - P, the polynomial.
  - vars, the name of the variable (or the list of the names of variables).
  - Optionally, n, the degree (or the list of the degrees of the variables).
- coeff(Pvars ⟨,n⟩) returns the nth degree coefficient of P, or if n is not specified, the list of the coefficients of P, including 0 in the univariate dense case and excluding 0 in the multivariate sparse case.

#### Examples.

- Input:
  coeff(-x^4+3*x*y^2+x,x,1)
  Output:

  3 y2+1

- Input:
  coeff(-x^4+3x*y^2+x,y,2)
  Output:

  3 x

- Input:
  coeff(-x^4+3x*y^2+x,[x,y],[1,2])
  Output:

  3