Simple factorial and matrix question

In summary: In this case, it can be used to ensure that none of the numbers are reused in the grid by comparing the values in each slot to the total number of possible permutations. Another way to validate the entire grid is by using (n!)^(n), which represents the total number of possible combinations of n slots with n numbers. This is a useful rule to know when dealing with grids that require unique numbers in each row, column, and block, such as sudoku.
  • #1
arpace
9
0
if I have n slots [1,2,3,4,5,...n] where I must use numbers from 1 through n, and I have to ensure that none of them were reused...

the way I figure to make sure that none of the numbers are reused is to multiply the values in each slot and compare them against n!

e.g. [1,2,3,4,5] would be correct, but [1,4,6,3,2] or [5,5,2,1,3]

kind of like sudoku's rule for a row but not quite
e.g. if I had n=6
[[1,2,3,4,5,6],
[6,1,2,3,4,5],
[5,6,1,2,3,4],
[4,5,6,1,2,3],
[3,4,5,6,1,2]]
that would be correct

Am I right in assuming that that n! would be useful for looping through the rows to see if they are correct? and then (n!)^(n) would be a way to validate the entire grid?

is this a rule I just don't know? is there a rule that is easier?
 
Last edited:
Mathematics news on Phys.org
  • #2
arpace said:
if I have n slots [1,2,3,4,5,...n] where I must use numbers from 1 through n, and I have to ensure that none of them were reused...

the way I figure to make sure that none of the numbers are reused is to multiply the values in each slot and compare them against n!

e.g. [1,2,3,4,5] would be correct, but [1,4,6,3,2] or [5,5,2,1,3]

kind of like sudoku's rule for a row but not quite
e.g. if I had n=6
[[1,2,3,4,5,6],
[6,1,2,3,4,5],
[5,6,1,2,3,4],
[4,5,6,1,2,3],
[3,4,5,6,1,2]]
that would be correct

Am I right in assuming that that n! would be useful for looping through the rows to see if they are correct? and then (n!)^(n) would be a way to validate the entire grid?

is this a rule I just don't know? is there a rule that is easier?



Google "permutations", and yes: there are n! different ways to order in an array the numbers 1,2,...,n in such a way that each

appears exactly once.

DonAntonio
 

Related to Simple factorial and matrix question

1. What is a factorial?

A factorial is a mathematical operation that calculates the product of all positive integers up to a given number. It is represented by an exclamation point (!) after the number, such as 5!, which equals 5 x 4 x 3 x 2 x 1 = 120.

2. How do you calculate a factorial?

To calculate a factorial, you multiply the given number by all positive integers that are smaller than it. For example, to calculate 5!, you would multiply 5 x 4 x 3 x 2 x 1 = 120. You can also use a calculator or a factorial function in a programming language to calculate larger factorials.

3. What is the purpose of a factorial in mathematics?

Factorials have many uses in mathematics, including in probability and statistics, combinatorics, and calculus. They are also used in solving equations and simplifying expressions. Factorials can be used to calculate the number of ways a set of objects can be arranged or the number of combinations of objects.

4. What is a matrix?

A matrix is a rectangular array of numbers or symbols arranged in rows and columns. It is used to represent a set of linear equations or to perform operations such as addition, subtraction, and multiplication. Matrices are commonly used in fields such as engineering, economics, and computer science.

5. How do you multiply matrices?

To multiply matrices, the number of columns in the first matrix must match the number of rows in the second matrix. The product will have the same number of rows as the first matrix and the same number of columns as the second matrix. To find the value of each entry in the product, you multiply the corresponding elements in the row of the first matrix by the corresponding elements in the column of the second matrix and then add the products together.

Similar threads

Replies
8
Views
2K
  • Precalculus Mathematics Homework Help
2
Replies
57
Views
3K
Replies
12
Views
1K
  • Calculus and Beyond Homework Help
Replies
4
Views
1K
  • General Math
Replies
5
Views
1K
Replies
9
Views
2K
  • General Math
4
Replies
125
Views
17K
  • Calculus and Beyond Homework Help
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Advanced Physics Homework Help
Replies
1
Views
1K
Back
Top