The Question
Let $A \in \mathbb{R}^{n \times n}$ be the matrix of a linear transformation.
I have learned that any linear transformation is either a rotation, a streching, or a mirroring (with the latter one being a special type of stretching with a multiplier of $-1$).
So is it possible to algebraically decompose $A$ into a purely rotational part $R$ and a purely stretching part $S$?
Definitions
A square matrix $R$ is a rotation matrix exactly if it is orthogonal $(R^T = R^{-1})$ and $\det(R)=1$.
An $n$ by $n$ square matrix $S$ is a stretch matrix exactly if it has $n$ real eigenvalues (counted with algebraic multiplicity). As such, $S$ has a real eigendecomposition $S = U^T \Lambda U$, where $U$ is orthogonal and $\Lambda = \text{diag}(\lambda_1,\dots,\lambda_n)$ with $\lambda_1,\dots,\lambda_n \in \mathbb{R}$
Algebraic phrasing of the Question
Given $A \in \mathbb{R}^{n \times n}$, does there exist $R,S \in \mathbb{R}^{n \times n}$ such that
- $A = RS$
- $R^T = R^{-1}$
- $\det(R)=1$
- $S = U^T \Lambda U$
- $U^T = U^{-1}$
- $\Lambda$ is a diagonal matrix with real entries
Furthermore, is this decomposition unique?
The closest decomposition I see to your issue is the so-called $QR$ decomposition.
It must be said at first that we have to adopt a multiplicative convention for the composition of two operations : we have to write is $RS$ instead of $R+S$ .
The $QR$ decomposition of $A$ is the fact to write $A= QR$ with unique (up to a simultaneous change of sign in $Q$ and $R$) factors $Q$ (your $R$) and $R$ (your $S$) where:
$Q$ is an orthogonal matrix (not necessarily a rotation matrix),
$R$ is an upper triangular matrix (which is what you call a "stretch matrix").