Proof of transforming data to desired mean and standard deviation

A question of how to transform data to a desired mean and standard deviation has been answered here. However I would like to understand the properties that make this possible. How does one prove that the following is appropriate?

https://stats.stackexchange.com/a/46431/259588

The answers you quoted goes as follows :

Suppose you start $$\{x_i\}$$ with mean $$m_1$$ and non-zero standard deviation $$s_1$$ and you want to arrive at a similar set with mean $$m_2$$ and standard deviation $$s_2$$.

Then multiplying all your values by $$\frac{s_2}{s_1}$$ will give a set with mean $$m_1 \times \frac{s_2}{s_1}$$ and standard deviation $$s_2$$.

Now adding $$m_2 - m_1 \times \frac{s_2}{s_1}$$ will give a set with mean $$m_2$$ and standard deviation $$s_2$$.

So a new set $$\{y_i\}$$ with $$y_i= m_2+ (x_i- m_1) \times \frac{s_2}{s_1}$$ has mean $$m_2$$ and standard deviation $$s_2$$.

You woulEd get the same result with the three steps: translate the mean to $$0$$, scale to the desired standard deviation; translate to the desired mean.

To proove that the transformation : $$y_i= m_2+ (x_i- m_1) \times \frac{s_2}{s_1}$$

will give you desired standard deviation and mean, just compute the standard deviation and mean of this expression of the $$y_i$$'s :

$$\mathbb{E}(y_i) = \mathbb{E}(m_2+ (x_i- m_1) \times \frac{s_2}{s_1}) = m_2+ (\mathbb{E}(x_i)- m_1) \times \frac{s_2}{s_1} = m_2$$ and :

$$\mathbb{V}(y_i) = \mathbb{V}(m_2+ (x_i- m_1) \times \frac{s_2}{s_1}) = (\mathbb{V}(x_i) \times \frac{s_2^2}{s_1^2} = s_1^2 \frac{s_2^2}{s_1^2} = s_2^2$$

Remebre that the expectation is linear and that the variance is quadratic, meaning that for a random variable $$X$$ and scalars $$a,b$$,

$$\mathbb{E}(aX+b) = a\mathbb{E}(X)+b \text{ and } \mathbb{V}(aX+b) = a^2 \mathbb{V}(X)$$.

For the sake of completeness, remember also that the standard deviation is the square root of the variance..