Given a matrix where there is some varying number of columns and rows I need to calculate for any given 'tile' its ROW and COLUMN. Example, a matrix that has 3 columns and 3 rows will have a total of 9 tiles and tile#4 will be in the 1st column, 2nd row, whereas if it were a 4X4 matrix tile#4 would be in the 4th column, first row.  So the knowns at any given time are tileNumber, numberOfRows, and numberOfColumns.  From those variables I want a calculation for the associated column and row for any given tile.  Column = SomeFormula(tileNumber,NumberofRows)

Row = SomeFormula(tileNumber,NumberofColumns)

Example 3X3 matrix with associated tileNumbers.

1 | 2 | 3

4 | 5 | 6

7 | 8 | 9

 

in Algebra 1 Answers by

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

1 Answer

Let N=tile number, R=row number of the tile, C=column number of the tile. nR=number of rows, nC=number of columns. The matrix contains nR*nC tiles. The tiles are numbered from 1 to nR*nC from left to right on each row.

N-1=nC(R-1)+C-1 relates N, nC and R. Note that nR is absent. The reason for the -1's is that numbering starts from 1 rather than zero. The algorithms for calculating R and C need to cater for N>nR*nC; if this happens R and C could be returned as zero; similarly if N is negative or zero.

To find R, divide N-1 by nC to give a quotient and remainder. Add 1 to the quotient to get R and add 1 to the remainder to get C.

Take the 3*3 matrix. nC=nR=3, nC*nR=9. N must be between 1 and 9. Let N=5, so N-1=4. Divide 4 by 3 to give 1 remainder 1. So R=1+1=2 and C=2. Take a 7*5 matrix, nR=7 and nC=5. Let N=21, N-1=20. (N-1)/5=4 rem 0. So R=5 and C=1. But if nR=5 and nC=7 and N=21, we have 20/7=2 rem 6, so R=3 and C=7.

 

by Top Rated User (1.1m points)

Related questions

Welcome to MathHomeworkAnswers.org, where students, teachers and math enthusiasts can ask and answer any math question. Get help and answers to any math problem including algebra, trigonometry, geometry, calculus, trigonometry, fractions, solving expression, simplifying expressions and more. Get answers to math questions. Help is always 100% free!

Most popular tags

algebra problems solving equations word problems calculating percentages math problem geometry problems calculus problems math fraction problems trigonometry problems rounding numbers simplifying expressions solve for x order of operations probability algebra pre algebra problems word problem evaluate the expression slope intercept form statistics problems factoring polynomials solving inequalities 6th grade math how to find y intercept equation of a line sequences and series algebra 2 problems logarithmic equations solving systems of equations by substitution dividing fractions greatest common factor square roots geometric shapes graphing linear equations long division solving systems of equations least to greatest dividing decimals substitution method proving trigonometric identities least common multiple factoring polynomials ratio and proportion trig identity precalculus problems standard form of an equation solving equations with fractions http: mathhomeworkanswers.org ask# function of x calculus slope of a line through 2 points algebraic expressions solving equations with variables on both sides college algebra domain of a function solving systems of equations by elimination differential equation algebra word problems distributive property solving quadratic equations perimeter of a rectangle trinomial factoring factors of a number fraction word problems slope of a line limit of a function greater than or less than geometry division fractions how to find x intercept differentiation exponents 8th grade math simplifying fractions geometry 10th grade equivalent fractions inverse function area of a triangle elimination method story problems standard deviation integral ratios simplify systems of equations containing three variables width of a rectangle percentages area of a circle circumference of a circle place value solving triangles parallel lines mathematical proofs solving linear equations 5th grade math mixed numbers to improper fractions scientific notation problems quadratic functions number of sides of a polygon length of a rectangle statistics zeros of a function prime factorization percents algebra 1 evaluating functions derivative of a function equation area of a rectangle lowest common denominator solving systems of equations by graphing integers algebra 2 diameter of a circle dividing polynomials vertex of a parabola calculus problem perpendicular lines combining like terms complex numbers geometry word problems converting fractions to decimals finding the nth term range of a function 4th grade math greatest to least ordered pairs functions radius of a circle least common denominator slope unit conversion solve for y calculators solving radical equations calculate distance between two points area word problems equation of a tangent line multiplying fractions chemistry binomial expansion place values absolute value round to the nearest tenth common denominator sets set builder notation please help me to answer this step by step significant figures simplifying radicals arithmetic sequences median age problem trigonometry graphing derivatives number patterns adding fractions radicals midpoint of a line roots of polynomials product of two consecutive numbers limits decimals compound interest please help pre-algebra problems divisibility rules graphing functions subtracting fractions angles numbers discrete mathematics volume of a cylinder simultaneous equations integration probability of an event comparing decimals factor by grouping vectors percentage expanded forms rational irrational numbers improper fractions to mixed numbers algebra1 matrices logarithms how to complete the square mean statistics problem analytic geometry geometry problem rounding decimals 5th grade math problems solving equations with variables solving quadratic equations by completing the square simplifying trigonometric equation using identities
87,448 questions
99,049 answers
2,422 comments
4,784 users