### Theory:

If you divide $\frac{5}{2}$, you will obtain $2$ as the quotient and $1$ as the remainder.

Also here $5$ is the dividend, $2$ is the divisor, $2$ is the quotient, and $1$ is the remainder.

So we can write $5=\left(2×2\right)+1$

or Dividend $$=$$ (Divisor $$×$$ Quotient) $$+$$ Remainder

Note that the remainder is always less than the divisor.
In algebra, long division polynomial is an algorithm for dividing a polynomial by a same or lower degree polynomial, a generally used version of the common arithmetic technique known as long division.

Let’s try to divide the two polynomials.
Example:
where $p\left(x\right) =\phantom{\rule{0.147em}{0ex}}{2x}^{3}+\phantom{\rule{0.147em}{0ex}}{x}^{2}+\phantom{\rule{0.147em}{0ex}}x$$q\left(x\right) =\phantom{\rule{0.147em}{0ex}}x$.

$$(2x^3 + x^2 +x) ÷ x$$

$$=$$ $$\frac {2x^3}{x}+$$ $$\frac{x^2}{x}+$$$$\frac{x}{x}$$

$$=$$ $$2x^2$$ $$+$$ $$x$$ $$+$$ $$1$$.

In here, $$(2x^3 + x^2 +x)$$ is the dividend, $$x$$ is the divisor, $$2x^2$$ $$+$$ $$x$$ $$+$$ $$1$$ is the quotient and $$0$$ is the remainder.

Note that the remainder is $$0$$ as the polynomial $$q(x)$$ divides the polynomial $$p (x)$$ without any remainder.

Important!
In this case, $x$ is common to each term of $\phantom{\rule{0.147em}{0ex}}{2x}^{3}+\phantom{\rule{0.147em}{0ex}}{x}^{2}+\phantom{\rule{0.147em}{0ex}}x\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}$. So we can write $\phantom{\rule{0.147em}{0ex}}{2x}^{3}+\phantom{\rule{0.147em}{0ex}}{x}^{2}+\phantom{\rule{0.147em}{0ex}}x\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}$ as $x\left(\phantom{\rule{0.147em}{0ex}}{2x}^{2}+\phantom{\rule{0.147em}{0ex}}x+\phantom{\rule{0.147em}{0ex}}1\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}\right)$.

We say that $x$ and  $\phantom{\rule{0.147em}{0ex}}{2x}^{2}+\phantom{\rule{0.147em}{0ex}}x+1\phantom{\rule{0.147em}{0ex}}$ are factors of $\phantom{\rule{0.147em}{0ex}}{2x}^{3}+\phantom{\rule{0.147em}{0ex}}{x}^{2}+\phantom{\rule{0.147em}{0ex}}x\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}$, and $\phantom{\rule{0.147em}{0ex}}{2x}^{3}+\phantom{\rule{0.147em}{0ex}}{x}^{2}+\phantom{\rule{0.147em}{0ex}}x\phantom{\rule{0.147em}{0ex}}\phantom{\rule{0.147em}{0ex}}$ is a multiple of $x$ as well as a multiple of $\phantom{\rule{0.147em}{0ex}}{2x}^{2}+\phantom{\rule{0.147em}{0ex}}x+1\phantom{\rule{0.147em}{0ex}}$.
Example:
Let us try to divide $$p(x) =$$ $$3x^2 + x + 1$$ with $$q(x)= x$$.

$$(3x^2 + x + 1) ÷ x$$ $$=$$ $$(3x^2 ÷ x)$$ $$+ (x ÷ x)$$ $$+ (1 ÷ x)$$

$$= 3x + 1 + \frac{1}{x}$$.

Since the last term $$(1)$$ is not divisible by $$x$$, we will write this expression as

$$3x^2 + x + 1$$ $$=$$ $$(3x^2 + x)$$ $$+1$$

Separate the $$x$$ value from the expression.

$$((3x +1) (x)) +1$$

$$((3x +1) × x) +1$$

$$3x^2 + x + 1 =$$ $$((3x +1) × x) +1$$

Now compare the above expression with division algorithm, Dividend $$=$$ (Divisor $$×$$ Quotient) $$+$$ Remainder.

Important!
Note that $$1$$ is remainder here. In this case, $$3x+1$$ is the quotient and $$1$$ is the remainder.  Also here, $$x$$ is not a factor of $$3x^2 + x + 1$$, since the remainder is not zero.
Example:
Let us try to divide $$3x^3 – 5x^2 + 10x – 3$$ by $$3x + 1$$.

Just look at the leading terms, dividing $$3x^3$$ by $$3x$$ will get $$x^2$$. Keep this quotient to the top:

Multiplying this $$x^2$$ by $$3x + 1$$, we will get $$3x^3 + 1x^2$$ as below:

Then change the sign, add it down, and remember to carry the "$$+10x – 3$$" from the original dividend, giving a new bottom line of  $$– 6x^2 + 10x – 3$$:

Dividing the new leading term, $$– 6x^2$$, by the leading term divisor, $$3x$$, we get $$– 2x$$. Keep it to the top:

Then multiply $$– 2x$$ by $$3x + 1$$ $$=$$$$– 6x^2 – 2x$$ and enter under the bottom value. Change the signs, add them down, and remember to carry the dividend $$– 3$$:

The last line is then $$12x-3$$. Divide the new $$12x$$ lead term by $$3x$$, the lead term of the divisor, we will get $$+4$$. Keep it on top.

To get $$12x + 4$$ multiply $$4$$ by $$3x + 1$$. Change signs, then add them down. Thus, we end with the remainder $$-7$$:

Therefore, Dividend ($$3x^3 – 5x^2 + 10x – 3$$) $$=$$ Divisor ($$3x + 1$$)  $$×$$ Quotient ($$x^2-2x + 4$$) $$+$$ Remainder ($$-7$$).