# Algebra using Sage

Here are some examples of Sage used as a Computer algebra system.

Define the symbols x and y using var. Then define r2 in terms of x and y as per the Pythagorean theorem.

The output remains in terms of x and y:

This works with trigonometry…

Output:

…and matrices too. Below is an example of a matrix to translate and rotate a point in two dimensions.

Output:

Sage also does differentiation and integration but I am still trying to wrap my head around those two concepts.