Data 605 - question LT.C42

Heather Geiger - September 21, 2018

Question

The transformation of the following matrix:

matrix(c("a","c","b","d"),nrow=2,ncol=2)
##      [,1] [,2]
## [1,] "a"  "b" 
## [2,] "c"  "d"

Produces the result a + b + c - d.

Find the values of a,b,c, and d such that when in the matrix format shown, the transformation produces the result of 3.

Answer

We find that in this problem, the only value that is constrained is d.

Solve for d:

  1. a + b + c - d = 3
  2. -d = 3 - (a + b + c)
  3. d = -1 * (3 - (a + b + c))
  4. d = a + b + c - 3

So the solution is the following matrix, where a, b, and c can be any real numbers.

matrix(c("a","c","b","a + b + c - 3"),nrow=2,ncol=2)
##      [,1] [,2]           
## [1,] "a"  "b"            
## [2,] "c"  "a + b + c - 3"

If we were to translate this into numbers, this matrix could be true for many different sets of numbers. Let’s show one example.

Use function sample to set a, b, and c to a random integer between -1000 and 1000.

Then, set d = a + b + c - 3.

Finally, get the solution, which will always be 3, and show the matrix.

#I like to set the seed to my birthday :).
set.seed(1392)

a = sample(-1000:1000,1)
b = sample(-1000:1000,1)
c = sample(-1000:1000,1)
d = a + b + c - 3

print("Example matrix:")
## [1] "Example matrix:"
matrix(c(a,c,b,d),nrow=2,ncol=2)
##      [,1] [,2]
## [1,]  452  590
## [2,]  -44  995
print("Result of the transformation:")
## [1] "Result of the transformation:"
a + b + c - d
## [1] 3

We find that a matrix where a = 452, b = 590, and c = -44 means that d must be 995 under the parameters we have set.

This matrix is just one of many that meets the requirements.