## Basic Algebraic Operations

Basic algebraic operations on symbolic objects are the same
as operations on MATLAB^{®} objects of class `double`

.
This is illustrated in the following example.

The Givens transformation produces a plane rotation through
the angle `t`

. The statements

syms t G = [cos(t) sin(t); -sin(t) cos(t)]

create this transformation matrix.

G = [ cos(t), sin(t)] [ -sin(t), cos(t)]

Applying the Givens transformation twice should simply be a
rotation through twice the angle. The corresponding matrix can be
computed by multiplying `G`

by itself or by raising `G`

to
the second power. Both

A = G*G

and

A = G^2

produce

A = [ cos(t)^2 - sin(t)^2, 2*cos(t)*sin(t)] [ -2*cos(t)*sin(t), cos(t)^2 - sin(t)^2]

The `simplify`

function

A = simplify(A)

uses a trigonometric identity to return the expected form by trying several different identities and picking the one that produces the shortest representation.

A = [ cos(2*t), sin(2*t)] [ -sin(2*t), cos(2*t)]

The Givens rotation is an orthogonal matrix, so its transpose is its inverse. Confirming this by

I = G.' *G

which produces

I = [ cos(t)^2 + sin(t)^2, 0] [ 0, cos(t)^2 + sin(t)^2]

and then

I = simplify(I)

I = [ 1, 0] [ 0, 1]