It is similar on dividing whole numbers.
let y = x² + 4x - 12 / x - 2
Step 1:
Divide the first term of the dividend to that of the first term of the divisor.
x² / x = x
The quotient will be the first term of your answer.
Step 2:
Multiply first the quotient by the terms of the divisor.
x(x) = x²
x(-2) = -2x
And then put it below the terms of the dividend.
Step 3:
Subtract the terms of the divisor by the product.
x² - x² = 0
4x - (-2x) = 6x
Step 4:
Bring down one term left next to the difference.
6x - 12
Step 5:
Then go, repeat to step 1.
y = x + 6
Now, can you get it? :)