Well, we could argue about semantics, but I agree with what you are trying to say.
In both cases, it is squeezed by a factor of 2. In the first case y dimensions are halved. In the second case x dimension are halved.
when you have "y = 1/2sin2x". . .
Does the equation have a vertical compression by a factor of 1/2?
And does the equation have a horizontal compression by a factor of 2?
3 answers
Now if you want to express this as a scale change transformation.
It would be
S1,1/2 for the vertical shrink
and
S1/2,1 for the horizontal shrink
In the vertical case your scale change matrix operation would look like this
|1 0 | x = | 1 x|
|0 .5| y |1/2 y|
In the horizontal shrink, like this
|.5 0| x |1/2 x|
|0 1 | y = |1 y |
It would be
S1,1/2 for the vertical shrink
and
S1/2,1 for the horizontal shrink
In the vertical case your scale change matrix operation would look like this
|1 0 | x = | 1 x|
|0 .5| y |1/2 y|
In the horizontal shrink, like this
|.5 0| x |1/2 x|
|0 1 | y = |1 y |
Now if you do them both at once, as you did, the Scale is S1/2,1/2
and the matrix is
|.5 0|
|0 .5|
and the matrix is
|.5 0|
|0 .5|