For example, after making an identity matrix, i.e. mat4(1), and multiplying it by 2 to duplicate the size, how can I apply it for example on UV, i.e. vec2, coordinates?

Nothing too complicated, you just use the * multiplication operator. Note though that it only makes sense to multiply a mat4 by another mat4 (4x4), vec4 (4x1), or other 4x? matrix.

If you’re just aiming for 2D scaling and rotation, you probably want to start with a mat2. mat2 * vec2 = vec2

Just remembered about http://matrixmultiplication.xyz/ - this is a good way to visualise what’s actually going on during one of these operations.