Subtract $ \dfrac{7}{x-2} $ from $ x $ to get $ \dfrac{ \color{purple}{ x^2-2x-7 } }{ x-2 }$.
Step 1: Write $ x $ as a fraction by putting $ \color{red}{ 1 } $ in the denominator.
Step 2: To subtract raitonal expressions, both fractions must have the same denominator.
We can create a common denominator by multiplying the first fraction by $\color{blue}{ x-2 }$.
$$ \begin{aligned} x- \frac{7}{x-2} & \xlongequal{\text{Step 1}} \frac{x}{\color{red}{1}} - \frac{7}{x-2} = \frac{ x \cdot \color{blue}{ \left( x-2 \right) }}{ 1 \cdot \color{blue}{ \left( x-2 \right) }} - \frac{ 7 }{ x-2 } = \\[1ex] & \xlongequal{\text{Step 2}} \frac{ \color{purple}{ x^2-2x } }{ x-2 } - \frac{ \color{purple}{ 7 } }{ x-2 }=\frac{ \color{purple}{ x^2-2x-7 } }{ x-2 } \end{aligned} $$