---
title: "Math 339SP -- Reduced row echelon form"
author: "Tim Chumley"
date: "Spring 2022"
output:
pdf_document: default
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tinytex)
library(expm)
library(pracma)
library(MASS)
```
# Problem 1
```{r}
P = matrix(c(1/4, 3/4,
2/3, 1/3), nrow = 2, ncol = 2, byrow = T)
A = cbind(t(P-eye(2)), c(0,0))
A = rbind(A, c(1,1,1))
rref(A) # the command to find its reduced row echelon form
fractions(rref(A)) # the fractions command is part of the MASS package
```
# Problem 2
```{r}
P = matrix(c(1/2, 1/2, 0,
1/3, 2/3, 0,
0, 0, 1), nrow = 3, ncol = 3, byrow = T)
A = cbind(t(P-eye(3)), c(0,0,0))
A = rbind(A, c(1,1,1,1))
rref(A) # the command to find its reduced row echelon form
fractions(rref(A)) # the fractions command is part of the MASS package
```
# Problem 3
```{r}
P = matrix(c(1/2, 1/2, 0, 0,
1/3, 2/3, 0, 0,
0, 0, 4/5, 1/5,
0, 0, 1/4, 3/4), nrow = 4, ncol = 4, byrow = T)
A = cbind(t(P-eye(4)), c(0,0,0,0))
A = rbind(A, c(1,1,1,1,1))
rref(A) # the command to find its reduced row echelon form
fractions(rref(A)) # the fractions command is part of the MASS package
```