Problem #1 :

Clear["Global`*"]

v={x,y};
g=DiagonalMatrix[{1,1}];
g //MatrixForm

rot={{c,+s},{-s,c}};
rot //MatrixForm

v2=rot.v

v2.g.v2 //Expand

v2.g.v2 //Collect[#,{x,y}]&

v2.g.v2 /.{c->Cos[θ],s->Sin[θ]} //Simplify

v.g.v

Problem #2 :

Clear["Global`*"]

v={t,x};
g=DiagonalMatrix[{1,-1}];
g //MatrixForm

rot={{c,+s},{+s,c}};
rot //MatrixForm

v2=rot.v

v2.g.v2 //Expand

v2.g.v2 //Collect[#,{t,x}]&

v2.g.v2 /.{c->Cosh[θ],s->Sinh[θ]} //Simplify

v.g.v