Theory:

Let us discuss the subtraction of two rational expressions in two cases.
 
Case 1: Like Denominators
 
If the rational numbers are of the form \(\frac{p(x)}{q(x)}\) and \(\frac{r(x)}{q(x)}\), the subtraction is performed as follows.
 
Working Rule:
Step 1: Subtract the numerators \(p(x)\) and \(r(x)\).
 
Step 2: Write the difference of the numerators found in the previous step over the common denominator \(q(x)\).
 
Step 3: Reduce the resulting rational expression \(\frac{p(x) - r(x)}{q(x)}\) into its lowest form.
Example:
Subtract: \(\frac{2x + 1}{x + 1}\) and \(\frac{5x + 4}{x + 1}\)
 
Solution:
 
Step 1: Subtract the numerators.
 
\(2x + 1\) \(-\) \(5x + 4\) \(=\) \((2 - 5)x + (1 - 4)\)
 
\(=\) \(-3x - 3\)
 
Step 2: Write the difference of the numerators found in the previous step over the common denominator.
 
\(\frac{2x + 1}{x + 1}\) \(-\) \(\frac{5x + 4}{x + 1}\) \(=\) \(\frac{-3x - 3}{x + 1}\)
 
Step 3: Reduce the resulting rational expression into its lowest form.
 
\(\frac{-3x - 3}{x + 1}\) \(=\) \(\frac{-3(x + 1)}{x + 1}\)
 
\(=\) 3x+1x+1
 
\(=\) \(-3\)
 
Therefore, \(\frac{2x + 1}{x + 1}\) \(-\) \(\frac{5x + 4}{x + 1}\) \(=\) \(-3\).
Case 2: Unlike Denominators
 
If the rational numbers are of the form \(\frac{p(x)}{q(x)}\) and \(\frac{r(x)}{s(x)}\), the subtraction is performed as follows.
 
Working Rule:
Step 1: Determine the Least Common Multiple of the denominator \(q(x)\) and \(s(x)\).

Step 2: Rewrite each fraction as an equivalent fraction with the \(LCM\) obtained in the previous step by multiplying both the numerators and denominator of each expression by any factors needed to obtain the \(LCM\).
 
Step 3: Follow the same steps given for doing subtraction of the rational expression with like denominators.
Example:
Subtract: \(\frac{2x}{x + 1}\) and \(\frac{5x}{x + 2}\)
 
Solution:
 
Step 1: Determine the Least Common Multiple of the denominator.
 
\(LCM \left((x+1)(x+2) \right)\) \(=\) \((x+1)(x+2)\)
 
Step 2: Rewrite each fraction as an equivalent fraction with the \(LCM\) obtained in the previous step by multiplying both the numerators and denominator of each expression by any factors needed to obtain the \(LCM\).
 
\(\frac{2x}{x + 1}\) \(-\) \(\frac{5x}{x + 2}\) \(=\) \(\frac{2x \times (x+2)}{(x + 1) \times (x+2)}\) \(-\) \(\frac{5x \times (x+1)}{(x + 2) \times (x+1)}\)
 
\(=\) \(\frac{2x^2 + 4x}{(x + 1)(x+2)}\) \(-\) \(\frac{5x^2 + 5x}{(x + 2)(x+1)}\)
 
Step 3: Follow the same steps given for doing subtraction of the rational expression with like denominators.
 
\(\frac{2x^2 + 4x}{(x + 1)(x+2)}\) \(-\) \(\frac{5x^2 + 5x}{(x + 2)(x+1)}\) \(=\) \(\frac{(2 - 5)x^2  + (2 - 5)x}{(x + 1)(x+2)}\)
 
\(=\) \(\frac{-3x^2 - 3x}{(x + 1)(x+2)}\)
 
\(=\) \(\frac{-3x(x + 1)}{(x + 1)(x+2)}\)
 
\(=\) 3xx+1x+1x+2
 
\(=\) \(\frac{-3x}{x+2}\)
 
Therefore, \(\frac{2x}{x + 1}\) \(-\) \(\frac{5x}{x + 2}\) \(=\) \(\frac{-3x}{x+2}\).