simplifying expressions – Making a equation smaller and more readable by using another variable

I am deriving an expression and the output of it is a very long mathematical expression. I want to minimize the equation by substituting some other variables. For example:

$$
`output = frac{x^2+3x^8+x sin(x+y)(y^2+3x^8+yx )}{xcos(x+y)(y2+3×8+yx)}

needed output = frac{x^2+3x^8+x A(y^2+3x^8+yx )}{xB(y2+3×8+yx)} where A=sin(x+y)cos(x+y)
$$

This is just an example equation, is it possible for mathematical to automatically do this?