# Set up a system of linear equations to represent the scenario. Solve the system by using...

## Question:

Set up a system of linear equations to represent the scenario. Solve the system by using Gaussian elimination or Gauss-Jordan elimination.

Amanda stayed in three different cities (Washington, D.C., Atlanta, Georgia, and Dallas, Texas) for a total of 13 nights. She spent twice as many nights in Dallas as she did in Washington. The total cost for 13 nights (excluding tax) was $2210 Determine the number of nights that she spent in each city. City Cost per Night Washington$230
Atlanta $140 Dallas$160

## System of Linear Equations:

{eq}\\ {/eq}

When the degree of all the variables in an equation is one, then the equation is termed as a linear equation.

A linear equation in three variables: x, y and z, represents a plane and a system of linear equations represents a set of planes that may (or may not) intersect to give a point solution.

It is convenient to represent a system of equations in its matrix form: {eq}A \textbf{x} = B {/eq}, which is solved by performing row-column transformations with methods like Gauss elimination or Gauss Jordan.

{eq}\\ {/eq}

Let Amanda spend x nights in Washington, y nights in Atlanta and z nights in Dallas.

She spent a total of 13 nights on the entire trip, implies:

{eq}\begin{align*} x+y+z &= 13 && \dots (1) \end{align*} {/eq}

Cost of hotel per night in each city is: {eq}$230 {/eq} in Washington, {eq}$140 {/eq} in Atlanta and {eq}$160 {/eq} in Dallas. Total money spent on hotels during the entire trip was {eq}$2210 {/eq}, which implies:

{eq}\begin{align*} 230x + 140y + 160z &= 2210 && \dots (2) \end{align*} {/eq}

Also, she spent twice as many nights in Dallas as she did in Washington, which implies: {eq}z = 2x {/eq}, or

{eq}\begin{align*} -2x+z &= 0 && \dots (3) \end{align*} {/eq}

Equations (1), (2) and (3) form a sytem of linear equations in x, y and z and they can be expressed in the form: {eq}A \textbf{x} = B {/eq}, where {eq}A {/eq} is the matrix of all the coefficients of x, y and z:

{eq}\begin{align*} A = \begin{bmatrix} 1 & 1 & 1 \\ 230 & 140 & 160 \\ -2 & 0 & 1 \end{bmatrix} \end{align*} {/eq}

{eq}\textbf{x} {/eq} is the variable matrix: {eq}[x,y,z]^T {/eq}, and {eq}B {/eq} is formed by the terms on the right hand side of the equations:

{eq}\begin{align*} B = \begin{bmatrix} 13 \\ 2210 \\ 0 \end{bmatrix} \end{align*} {/eq}

Therefore, the problem in matrix form is presented as:

{eq}\begin{align*} \begin{bmatrix} 1 & 1 & 1 \\ 230 & 140 & 160 \\ -2 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ z \end{bmatrix} = \begin{bmatrix} 13 \\ 2210 \\ 0 \end{bmatrix} \end{align*} {/eq}

The Gauss elimination method used to solve the system of linear equations tries to reduce the coefficient matrix in triangular form by performing row operations on the augmented matrix {eq}[A | B] {/eq}:

{eq}\begin{align*} [A | B] &=\begin{bmatrix} 1 & 1 & 1 & | & 13\\ 230 & 140 & 160 & | & 2210\\ -2 & 0 & 1 & | & 0 \end{bmatrix} \end{align*} {/eq}

The first element of the first row of {eq}[A|B] {/eq} is called the pivot element and it is used in row operations to reduce the elements below it to zero.

{eq}R_2 = R_2 - R_1 \times 230 {/eq}: Mulitply the first row {eq}R_1 {/eq} by 230 and subtract it from the second row {eq}R_2 {/eq}:

{eq}\begin{align*} [A | B] &=\begin{bmatrix} 1 & 1 & 1 & | & 13\\ 0 & -90 & -70 & | & -780\\ -2 & 0 & 1 & | & 0 \end{bmatrix} \\ \\ &[R_3 = R_3 + R_1 \times 2 ] \\ \\ [A | B] &=\begin{bmatrix} 1 & 1 & 1 & | & 13\\ 0 & -90 & -70 & | & -780\\ 0 & 2 & 3 & | & 26 \end{bmatrix} \\ \\ &[R_3 = R_3 \times 45 + R_2 ] \\ \\ [A | B] &=\begin{bmatrix} 1 & 1 & 1 & | & 13\\ 0 & -90 & -70 & | & -780\\ 0 & 0 & 65 & | & 390 \end{bmatrix} \\ \end{align*} {/eq}

{eq}A {/eq} has been reduced to an upper triangular form:

{eq}\begin{align*} A = \begin{bmatrix} 1 & 1 & 1 \\ 0 & -90 & -70 \\ 0 & 0 & 65 \end{bmatrix} \end{align*} {/eq}

so we can stop the process and rewrite the system in the reduced form:

{eq}\begin{align*} \begin{bmatrix} 1 & 1 & 1 \\ 0 & -90 & -70 \\ 0 & 0 & 65 \end{bmatrix} \cdot \begin{bmatrix} x \\ y \\ z \end{bmatrix} = \begin{bmatrix} 13 \\ -780 \\ 390 \end{bmatrix} \end{align*} {/eq}

By performing matrix multiplication we get back the equaitons as:

{eq}\begin{align*} x+y+z &= 13 && \dots (1') \\ -90y-70z &= -780 && \dots (2') \\ 65z &= 390 && \dots (3') \end{align*} {/eq}

Solve (3') for z and then back sustitute:

{eq}\begin{align*} z &= \frac{390}{65} = 6 \\ -90y - 70(6) &= -780 \implies -90y = -360 \implies y = 4 \\ x+4+6 &= 13 \implies x = 3 \\ \\ \end{align*} {/eq}

Answer: Amanda spends 3 nights in Washington, 4 nights in Atlanta and 6 nights in Dallas. 