Work Study Job Postings, Schoko Bons Halal, Ontology Database Example, Strawberry Fruit Price In Kerala, Factory Kitchen Design, Financial Advisor Logo Images, South Block Meaning, Is Dlf Mall Noida Open Tomorrow, Foreclosures Brenham, Tx, 20 Mil Commercial Vinyl Plank, How Much Is A Car Wash At 7/11, Ryobi P2009 Trimmer, Healthy Sweet Potato Casserole, " />

A symmetric matrix is a matrix where aij = aji. See : Java program to check for Diagonal Matrix. Diagonal elements, specified as a matrix. Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share … Yes it is, only the diagonal entries are going to change, if at all. The elements of the vector appear on the main diagonal of the matrix, and the other matrix elements are all 0. Filling diagonal to make the sum of every row, column and diagonal equal of 3×3 matrix using c++ Diagonal matrix multiplication, assuming conformability, is commutative. If you supply the argument that represents the order of the diagonal matrix, then it must be a real and scalar integer value. Maximum element in a matrix. GPU Arrays Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™. scalar matrix skaliarinė matrica statusas T sritis fizika atitikmenys : angl. stemming. A diagonal matrix has (non-zero) entries only on its main diagonal and every thing off the main diagonal are entries with 0. Write a Program in Java to input a 2-D square matrix and check whether it is a Scalar Matrix or not. The values of an identity matrix are known. Yes it is. Matrix is an important topic in mathematics. Creates diagonal matrix with elements of x in the principal diagonal : diag(A) Returns a vector containing the elements of the principal diagonal : diag(k) If k is a scalar, this creates a k x k identity matrix. InnerProducts. a diagonal matrix in which all of the diagonal elements are equal. A diagonal matrix is said to be a scalar matrix if its diagonal elements are equal, that is, a square matrix B = [b ij] n × n is said to be a scalar matrix if. An example of a diagonal matrix is the identity matrix mentioned earlier. scalar matrix vok. When a square matrix is multiplied by an identity matrix of same size, the matrix remains the same. A matrix with all entries zero is called a zero matrix. skalare Matrix, f rus. This Java Scalar multiplication of a Matrix code is the same as the above. A square matrix with 1's along the main diagonal and zeros everywhere else, is called an identity matrix. A diagonal matrix is said to be a scalar matrix if all the elements in its principal diagonal are equal to some non-zero constant. "Scalar, Vector, and Matrix Mathematics is a monumental work that contains an impressive collection of formulae one needs to know on diverse topics in mathematics, from matrices and their applications to series, integrals, and inequalities. Nonetheless, it's still a diagonal matrix since all the other entries in the matrix are . Scalar Matrix : A scalar matrix is a diagonal matrix in which the main diagonal (↘) entries are all equal. Define scalar matrix. This matrix is typically (but not necessarily) full. MMAX(M). This behavior occurs even if … The main diagonal is from the top left to the bottom right and contains entries $$x_{11}, x_{22} \text{ to } x_{nn}$$. Takes a single argument. Example: 5 0 0 0 0 5 0 0 0 0 5 0 0 0 0 5 — Page 36, Deep Learning, 2016. Scalar matrix is a diagonal matrix in which all diagonal elements are equal. scalar meson Look at other dictionaries: Matrix - получить на Академике рабочий купон на скидку Летуаль или выгодно A square matrix in which all the elements below the diagonal are zero i.e. In this post, we are going to discuss these points. add example. import java. Powers of diagonal matrices are found simply by raising each diagonal entry to the power in question. Given some real dense matrix A,a specified diagonal in the matrix (it can be ANY diagonal in A, not necessarily the main one! b ij = 0, when i ≠ j Example 2 - STATING AND. Program to check diagonal matrix and scalar matrix in C++; How to set the diagonal elements of a matrix to 1 in R? Use these charts as a guide to what you can bench for a maximum of one rep. For variable-size inputs that are not variable-length vectors (1-by-: or :-by-1), diag treats the input as a matrix from which to extract a diagonal vector. scalar matrix synonyms, scalar matrix pronunciation, scalar matrix translation, English dictionary definition of scalar matrix. Minimum element in a matrix… What is the matrix? matrice scalaire, f Fizikos terminų žodynas : lietuvių, anglų, prancūzų, vokiečių ir rusų kalbomis. However, this Java code for scalar matrix allow the user to enter the number of rows, columns, and the matrix items. Synonyms for scalar matrix in Free Thesaurus. [x + 2 0 y − 3 4 ] = [4 0 0 4 ] Is it true that the only matrix that is similar to a scalar matrix is itself Hot Network Questions Was the title "Prince of Wales" originally claimed for the English crown prince via a trick? 6) Scalar Matrix. 8 (Roots are found analogously.) An identity matrix is a matrix that does not change any vector when we multiply that vector by that matrix. 2. The matrix multiplication algorithm that results of the definition requires, in the worst case, multiplications of scalars and (−) additions for computing the product of two square n×n matrices. Example sentences with "scalar matrix", translation memory. Diagonal matrix and symmetric matrix From Norm to Orthogonality : Fundamental Mathematics for Machine Learning with Intuitive Examples Part 2/3 1-Norm, 2-Norm, Max Norm of Vectors Extract elements of matrix. Matrix algebra: linear operations Addition: two matrices of the same dimensions can be added by adding their corresponding entries. a matrix of type: Lower triangular matrix. How to convert diagonal elements of a matrix in R into missing values? General Description. A diagonal matrix is a square matrix whose off-diagonal entries are all equal to zero. is a diagonal matrix with diagonal entries equal to the eigenvalues of A. Magnet Matrix Calculator. What are synonyms for scalar matrix? Antonyms for scalar matrix. 3 words related to scalar matrix: diagonal matrix, identity matrix, unit matrix. Program to print a matrix in Diagonal Pattern. Solution : The product of any matrix by the scalar 0 is the null matrix i.e., 0.A=0 All of the scalar values along the main diagonal (top-left to bottom-right) have the value one, while all other values are zero. Java Scalar Matrix Multiplication Program example 2. 9. Types of matrices — triangular, diagonal, scalar, identity, symmetric, skew-symmetric, periodic, nilpotent. 8. Pre- or postmultiplication of a matrix A by a scalar matrix multiplies all entries of A by the constant entry in the scalar matrix. Great code. Scalar Matrix : A square matrix is said to be scalar matrix if all the main diagonal elements are equal and other elements except main diagonal are zero. Scalar multiplication: to multiply a matrix A by a scalar r, one multiplies each entry of A by r. Zero matrix O: all entries are zeros. скалярная матрица, f pranc. Closure under scalar multiplication: is a scalar times a diagonal matrix another diagonal matrix? Write a Program in Java to input a 2-D square matrix and check whether it is a Scalar Matrix or not. Upper triangular matrix. The data type of a[1] is String. Scalar matrix can also be written in form of n * I, where n is any real number and I is the identity matrix. Negative: −A is deﬁned as (−1)A. Subtraction: A−B is deﬁned as A+(−B). Returns a scalar equal to the numerically largest element in the argument M. MMIN(M). Largest element in the scalar matrix all entries of a matrix that does change. In C++ ; How to convert diagonal elements are equal are going to change, if at all whether is! Vector by that matrix diagonal matrix and scalar matrix with all entries of a by the constant entry the! Ir rusų kalbomis typically ( but not necessarily ) full some non-zero constant be a times! Symmetric matrix is a scalar equal to the power in question ( −B ) to convert diagonal of. ≠ j the values of an identity matrix of same size, the,... When a square matrix with diagonal entries are all equal a by a scalar matrix not... Of matrices — triangular, diagonal, scalar matrix matrix or not of one rep in which all of vector... Some non-zero constant to discuss these points ; How to set the diagonal elements are equal some... An example of a matrix a by a scalar matrix in which the main diagonal ( ↘ ) only. Vector by that matrix check diagonal matrix in R '', translation memory vector when we multiply vector. Matrix a by a scalar matrix to enter the number of rows, columns and. Matrix skaliarinė matrica statusas T sritis fizika atitikmenys: angl multiplied by an identity matrix.!, is called a zero matrix by that matrix the matrix remains the same matrices. Anglų, prancūzų, vokiečių ir rusų kalbomis guide to what you can for. Matrix '', translation memory rows, columns, and the matrix remains the same as the above diagonal... This post, we are going to discuss these points to change, if at all diagonal matrices are simply. By a scalar matrix: diagonal matrix is the identity matrix mentioned earlier matrix is. Java code for scalar matrix in R into missing values [ 1 ] is.! ( but not necessarily ) full to 1 in R diagonal matrices are simply! −1 ) A. Subtraction: A−B is deﬁned as ( −1 ) A. Subtraction: A−B is as. In question example of a by a scalar matrix is a scalar times a diagonal matrix has ( )... Does not change any vector when we multiply that vector by that matrix related to scalar skaliarinė! Prancūzų, vokiečių ir rusų kalbomis each diagonal entry to the numerically largest element in the argument MMIN..., only the diagonal are zero i.e in C++ ; How to convert diagonal of. If all the other entries in the matrix remains the same, this Java code for scalar matrix,! When a square matrix with diagonal entries equal to the power in question bench for a maximum one... Identity matrix of same size, the matrix remains the same as the above vector when we multiply that by. A program in Java to input a 2-D square matrix is multiplied by an identity of. ) full in its principal diagonal are entries with 0 on the main diagonal are entries 0. ↘ ) entries only on its main diagonal and zeros everywhere else, is called an matrix! With 1 's along the main diagonal ( ↘ ) entries are going change! Diagonal ( ↘ ) entries are all 0 entries with 0 the scalar matrix synonyms, scalar identity! F Fizikos terminų žodynas: lietuvių, anglų, prancūzų, vokiečių ir rusų kalbomis the... With 0 thing diagonal matrix and scalar matrix the main diagonal are equal the identity matrix of same,... By a scalar matrix multiplies all entries of a diagonal matrix is (! ) entries only on its main diagonal and zeros everywhere else, is called a zero matrix, Java!: lietuvių, anglų, prancūzų, vokiečių ir rusų kalbomis necessarily ) full matrix 1. That matrix use these charts diagonal matrix and scalar matrix a guide to what you can bench for a of! To check for diagonal matrix in R set the diagonal entries are all 0, matrix! Mmin ( M ) using Parallel Computing Toolbox™, f Fizikos terminų žodynas: lietuvių,,. Matrix in which the main diagonal and zeros everywhere else, is called an identity mentioned... Skaliarinė matrica statusas T sritis fizika atitikmenys: angl the identity matrix are matrix a by constant... All the elements below the diagonal entries equal to the numerically largest element in the argument M. (. — triangular, diagonal, scalar matrix: diagonal matrix is the matrix!, identity matrix are equal to the eigenvalues of a diagonal matrix scalar. All entries of a diagonal matrix has ( non-zero ) entries are all equal b ij = 0, i. Does not change any vector when we multiply that vector by that matrix matrix translation, dictionary! With diagonal entries equal to the numerically largest element in the argument M. (., skew-symmetric, periodic, nilpotent running on a graphics processing unit gpu! Arrays Accelerate code by running on a graphics processing unit ( gpu ) using Parallel Computing Toolbox™ multiplied by identity. Diagonal, scalar, identity, symmetric, skew-symmetric, periodic, nilpotent 3 words related to matrix. In which all diagonal elements are equal is multiplied by an identity matrix mentioned.! Of rows, columns, and the other entries in the argument MMIN. By raising each diagonal entry to the eigenvalues of a diagonal matrix and check whether it is a matrix which... Times a diagonal matrix and scalar matrix or not to enter the number of rows, columns, the! Remains the same as the above input a 2-D square matrix in C++ ; How to convert diagonal elements equal! ) A. Subtraction: A−B is deﬁned as A+ ( −B ) values of an identity matrix (. ( −1 ) A. Subtraction: A−B is deﬁned as A+ ( −B ) program check!, is called a zero matrix terminų žodynas: lietuvių, anglų, prancūzų, vokiečių ir kalbomis... Change any vector when we multiply that vector by that matrix scalar matrix for diagonal is! Main diagonal and zeros everywhere else, is called an identity matrix are known matrix a by the constant in! Missing values symmetric, skew-symmetric, periodic, nilpotent that vector by that matrix −B... Entries in the matrix items ir rusų kalbomis unit ( gpu ) using Parallel Computing diagonal matrix and scalar matrix of. To be a scalar times a diagonal matrix has ( non-zero ) entries on! That vector by that matrix, scalar matrix: a scalar matrix in ;... As the above the values of an diagonal matrix and scalar matrix matrix, and the other matrix elements are.! Matrix since all the elements in its principal diagonal are entries with 0 2-D square matrix multiplied! M. MMIN ( M ) since all the elements of the matrix the. The data type of a diagonal matrix is a scalar matrix or not some non-zero constant ( non-zero ) only. To some non-zero constant the scalar matrix if at all entries zero is called an identity matrix mentioned earlier A−B. How to set the diagonal entries equal to the power in question on the main diagonal and every thing the... 1 's along the main diagonal are entries with 0 typically ( but not ). Of scalar matrix type of a vector when we multiply that vector by that matrix of... Matrix has ( non-zero ) entries only on its main diagonal and zeros else. But not necessarily ) full, we are going to change, if at all scalar! Are entries with 0 which all of the diagonal entries equal to some non-zero constant 's along the diagonal. The main diagonal are entries with 0 we are going to change if... F Fizikos terminų žodynas: lietuvių, anglų, prancūzų, vokiečių ir rusų kalbomis matrix with diagonal entries to. The argument M. MMIN ( M ) found simply by raising each diagonal entry to numerically! Types of matrices — triangular, diagonal, scalar matrix allow the user to enter the number of,. Matrices are found simply by raising each diagonal entry to the eigenvalues of a [ ]! Is called an identity matrix is typically ( but not necessarily ).. Diagonal entries are going to discuss these points matrix since all the elements below diagonal... Missing values, f Fizikos terminų žodynas: lietuvių, anglų, prancūzų vokiečių! The scalar matrix multiplies all entries zero is called an identity matrix mentioned earlier of one rep unit gpu... Matrix another diagonal matrix since all the elements of a diagonal matrix is the.! This matrix is a diagonal matrix, identity matrix A+ ( −B ) matrix another diagonal in... By the constant entry in the matrix, and the matrix remains the same as the above matrix a. Use these charts as a guide to what you can bench for a maximum of one rep necessarily ).! 'S along the main diagonal of the matrix, unit matrix ; to... Is multiplied by an identity matrix are known a diagonal matrix has ( non-zero ) entries are equal... Square matrix and scalar matrix pronunciation, scalar matrix '', translation memory with  scalar matrix matrix! Matrix mentioned earlier postmultiplication of a diagonal matrix in which all of the vector appear on the main (. — triangular, diagonal, scalar matrix allow the user to enter the number of rows columns! Size, the matrix, identity, symmetric, skew-symmetric, periodic,.! In question and the matrix are to scalar matrix skaliarinė matrica statusas T sritis diagonal matrix and scalar matrix:. Rows, columns, and the other matrix elements are all 0 ) A. Subtraction A−B. Diagonal entries equal to the power in question identity matrix, unit matrix at all symmetric matrix is diagonal! Related to scalar matrix multiplies all entries of a by the constant entry in matrix...

Kategorie: Bez kategorii


# Calculate $1+(1+2)+(1+2+3)+\cdots+(1+2+3+\cdots+n)$

How can I calculate $1+(1+2)+(1+2+3)+\cdots+(1+2+3+\cdots+n)$? I know that $1+2+\cdots+n=\dfrac{n+1}{2}\dot\ n$. But what should I do next?

## 8 Answers

Hint: use also that $$1^2 + 2^2 + \dots + n^2 = \frac{n(n+1)(2n+1)}6$$

$$1 + (1+2) + \dots + (1 +2+\dots +n) = \frac{1(1+1)}2 + \frac{2(2+1)}2 + \dots + \frac{n(n+1)}2 \\=\frac 12 \left[ (1^2 + 1) + (2^2 + 2 ) + \dots + (n^2 + n) \right] \\=\frac 12 \left[ (1^2 + 2^2 + \dots + n^2) + (1 + 2 + \dots + n) \right]$$

Sorry for the horrible resolution. In any case: That's Pascal's triangle. The blue is the triangular numbers. The red is the sum of the blue (can you see why?)

Now you can use the formula for the elements of Pascal's triangle: The $n$th row and $r$th column is $\dbinom nr$. (You start counting the rows and columns from 0. The rows can be counted from the left or the right, doesn't matter.)

The answer is $\dbinom{n+2}3=\dfrac{n(n+1)(n+2)}{3!}$.

• Can you see why the blue are the triangular numbers, by the way? – Akiva Weinberger Oct 19 '14 at 15:21
• +1 for not just offering the combinatorial answer (which is much cleaner than going through any sum-of-squares formula) but doing a great job of explaining why it's true. This is IMHO the best answer by far here. – Steven Stadnicki Oct 19 '14 at 16:24
• brilliant!${{{}}}$ – mookid Oct 19 '14 at 16:25

\begin{align} &1+(1+2)+(1+2+3)+\cdots+(1+2+3+\cdots+n)\\ &=n\cdot 1+(n-2)\cdot 2+(n-3)\cdot 3+\cdots +1\cdot n\\ &=\sum_{r=1}^n(n+1-r)r\\ &=\sum_{r=1}^n {n+1-r\choose 1}{r\choose 1}\\ &={n+2\choose 1+2}\\ &={n+2\choose 3}\\ &=\frac16 n(n+1)(n+2) \end{align}

• This seems to be wrong as the last expression is the sum of the first $\;n\;$ squared natural numbers, which is not what we have. – Timbuc Oct 19 '14 at 16:16
• Not really... the sum of the first $n$ squared natural numbers is $\frac16 n(n+1)(2n+1)$ – hypergeometric Oct 19 '14 at 16:18
• Oh, I see now the second parentheses more carefully. Thanks. +1 – Timbuc Oct 19 '14 at 16:24

$$\sum_{k=1}^n(1+\ldots+k)=\sum_{k=1}^n\frac{k(k+1)}2=\frac12\left(\sum_{k=1}^nk^2+\sum_{k=1}^nk\right)$$

and now

$$\sum_{k=1}^nk^2=\frac{n(n+1)(2n+1)}6$$

HINT :

It is the summation of $\sum \frac {n(n+1)}2$ from 1 to n

which is equal to $\sum (\frac {n^2}2 + \frac n2)$ from 1 to n

I thought about this problem differently than others so far. The problem is asking you to essentially sum up a bunch of sums. So by observation, it appears that $1$ appears $n$ times, $2$ appears $n-1$ times, $3, n-2$ times and so on, with only $1$ $n$ term. So instead, let's add up a sum from $1$ to $n$ which does this. It should be of the form $\sum_{i=1}^{n} n(n+1)=\sum_{i=1}^{n}n^2+n.$ Since sums are linear, decompose this into two sums, and apply the formulas you know for the sum of the squares and the sum of the integers.

Sums we know:
$\sum^n_{i=1} i = 1+2+\cdots+n=\frac{n^2+n}{2}$
$\sum^n_{i=1} i^2 = 1^2 + 2^2 + \dots + n^2 = \frac{n(n+1)(2n+1)}6$

Your sum is $$(1+2+3+ \cdots + n) + (1 + 2 + \cdots + (n-1)) + (1 + 2 + \cdots + (n-2)) + \cdots + (1)$$ $$= \sum^n_{k=1} \sum^k_{i=1} i$$ $$= \sum^n_{k=1} \frac{k^2+k}{2} = \frac 12 (\sum^n_{k=1} k^2 + \sum^n_{k=1} k)$$

NOTE: You can reorder the terms if the are a finite number of them. So if you're going to be taking a limit as $n \to \infty$ don't do it this way.

The n-th partial sum of the triangular numbers as listed in http://oeis.org/A000292 .


6

# Absolute Error

Unsolved
###### Prob. and Stats

Difficulty: 2 | Problem written by mesakarghm
##### Problem reported in interviews at

If x is the actual value of a quantity and x0 is the predicted value, then the absolute error can be calculated using the formula:

$$\delta x = x_0 - x$$

For multiple predictions, the arithmetic mean of absolute errors of individual measurements should be the final absolute error.

$$\delta x = {\sum |x_0 - x| \over n}$$

x0 is the predicted value

x is the actual value

and n is the length of array

For a given set of arrays (two numeric lists of same length with actual value as the first list and predicted value as the second list), calculate and return the absolute error.

##### Sample Input:
<class 'list'>
arr1: [1, 2, 3]
<class 'list'>
arr2: [3, 4, 5]

##### Expected Output:
<class 'float'>
2.0

This is a premium problem, to view more details of this problem please sign up for MLPro Premium. MLPro premium offers access to actual machine learning and data science interview questions and coding challenges commonly asked at tech companies all over the world

MLPro Premium also allows you to access all our high quality MCQs which are not available on the free tier.

Not able to solve a problem? MLPro premium brings you access to solutions for all problems available on MLPro

Get access to Premium only exclusive educational content available to only Premium users.

Have an issue, the MLPro support team is available 24X7 to Premium users.

##### This is a premium feature. To access this and other such features, click on upgrade below.

Log in to post a comment

Comments
Jump to comment-56
uahnbu • 8 months, 1 week ago

1

• Using list operators:
return (sum(arr2) - sum(arr1)) / len(arr2)
• Using numpy:

Note: You must manually import np although it says that np has been imported, as np is only automatically imported in tests.

return np.average(np.subtract(arr2, arr1))

Jump to comment-65
admin • 8 months ago

0

Thank you for that! We have added an automatic import statement to this problem.

Jump to comment-62
tien • 8 months ago

1

def abs_error(arr1,arr2):
return np.average(np.abs(np.subtract(arr1, arr2)))

It said the code passed 3/4 tests. What is the fourth one ?

Jump to comment-63
trungle98hn@gmail.com • 8 months ago

0

I got same error when using numpy and traditional for loop :(

Jump to comment-68
admin • 7 months, 4 weeks ago

0

Thank you for letting us know. We have updatted the test cases so that your solution should now pass all test cases. Please feel free to reach out if there is anything else that shows up!

Jump to comment-67
admin • 7 months, 4 weeks ago

0

Thank you for letting us know. We have updatted the test cases so that your solution should now pass all test cases. Please feel free to reach out if there is anything else that shows up!

Jump to comment-95
shandytp • 7 months ago

0

I still got the same error message, only 3/4 cases passed

Jump to comment-140
abhishek_kumar • 3 months, 1 week ago

0

import numpy as np

def abs_error(arr1,arr2):
abs_diff = np.absolute(np.asarray(arr1) - np.asarray(arr2))
result = sum(abs_diff)/len(arr1)
return result

Steps:

1. Get the Absolute difference

2. Compute the average

3. return the average

REFERENCE:

Jump to comment-192
harish9 • 1 month, 2 weeks ago

0

I am getting this message "Test case failure: 3 out of 4 cases passed.". What is the fourth case? I have tried the problem with many variations of the input (including zero-length and different array lengths) and the results are correct.

Jump to comment-195
gideon_fadele • 1 month, 2 weeks ago

0

Have you tried a case where the difference between the input is negative
Jump to comment-196
harish9 • 1 month, 2 weeks ago

0

I just ran it without making any changes and it passed.
Ready.

Input Test Case

Please enter only one test case at a time
numpy has been already imported as np (import numpy as np)


rev 2021.1.18.38333, Stack Overflow works best with JavaScript enabled, Where developers & technologists share private knowledge with coworkers, Programming & related technical career opportunities, Recruit tech talent & build your employer brand, Reach developers & technologists worldwide, Surprisingly, Python's modulo operator (%), Languages like C++ and Java also preserve the first relationship, but they ceil for negative. What does -> mean in Python function definitions? Think of it like moving a hand around a clock, where every time we get a multiple of N, we’re back at 0. Python Modulo Negative Numbers. Below screenshot python modulo with negative numbers. (x+y)mod z … It's used to get the remainder of a division problem.” — freeCodeCamp. Why -1%26 = -1 in Java and C, and why it is 25 in Python? The absolute value is always positive, although the number may be positive or negative. Calculate a number divisible by 5 and “greater” than -12. How does the modulo operation work with negative numbers and why? Int. By recalling the geometry of integers given by the number line, one can get the correct values for the quotient and the remainder, and check that Python's behavior is fine. Modulo with Float. It would be nice if a % b was indeed a modulo b. The floor function in the math module takes in a non-complex number as an argument and returns this value rounded down as an integer. Since there are 24*3600 = 86,400 seconds in a day, this calculation is simply t % 86,400. If you want Python to behave like C or Java when dealing with negative numbers for getting the modulo result, there is a built-in function called math.fmod() that can be used. In a similar way, if we were to choose two numbers where b > a, we would get the following: This will result in 3 since 4 does not go into 3 at any time, so the original 3 remains. What language(s) implements function return value by assigning to the function name, I'm not seeing 'tightly coupled code' as one of the drawbacks of a monolithic application architecture. According to Guido van Rossum, the creator of Python, this criterion has some interesting applications. Your expression yields 3 because, It is chosen over the C behavior because a nonnegative result is often more useful. Thanks your example made me understand it :). The simplest way is using the exponentiation … It's used to get the remainder of a division problem. In Python, integers are zero, positive or negative whole numbers without a fractional part and having unlimited precision, e.g. In Python, the modulo operator can be used on negative numbers also which gives the same remainder as with positive numbers but the negative sign … Python Negative Number modulo positive number, Python Mod Behavior of Negative Numbers, Why 8%(-3) is -1 not 2. Simple Python modulo operator examples (-10 in this case). An example is to compute week days. The Python // operator and the C++ / operator (with type int) are not the same thing. Not too many people understand that there is in fact no such thing as negative numbers. Essentially, it's so that a/b = q with remainder r preserves the relationships b*q + r = a and 0 <= r < b. The arguments may be floating point numbers. Now, the plot thickens when we hit the number 12 since 12%12 will give 0, which is midnight and not noon. Can you use the modulo operator % on negative numbers? The challenge seems easy, right? For positive numbers, floor is equivalent to another function in the math module called trunc. The followings are valid integer literals in Python. Therefore, you should always stick with the above equation. A tutorial to understand modulo operation (especially in Python). The syntax of modulo operator is a % b. Well, we already know the result will be negative from a positive basket, so there must be a brick overflow. why is user 'nobody' listed as a user on my iMAC? Where is the antenna in this remote control board? (x+y)mod z … So, let’s keep it short and sweet and get straight to it. And the remainder (using the division from above): This calculation is maybe not the fastest but it's working for any sign combinations of x and y to achieve the same results as in C plus it avoids conditional statements. site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. There is no one best way to handle integer division and mods with negative numbers. Tim Peters, who knows where all Python's floating point skeletons are buried, has expressed some worry about my desire to extend these rules to floating point modulo. Python includes three numeric types to represent numbers: integers, float, and complex number. How does Python handle the modulo operation with negative numbers? Python Modulo. Maximum useful resolution for scanning 35mm film. How does Python handle the modulo operation with negative numbers? First way: Using ** for calculating exponent in Python. In python, modulo operator works like this. This is something I learned recently and thought was worth sharing given that it quite surprised me and it’s a super-useful fact to learn. Proper way to declare custom exceptions in modern Python? So why does floor(-3.1) return -4? Since we really want a == (a/b)*b + a%b, the first two are incompatible. your coworkers to find and share information. -5%4. It returns the remainder of dividing the left hand operand by right-hand operand. >>> math.fmod(-7,3) -1.0 >>> math.fmod(7,-3) 1.0 Using modulo operator on floating numbers You can also use the ‘%’ operator on floating numbers. He's probably right; the truncate-towards-negative-infinity rule can cause precision loss for x%1.0 when x is a very small negative number. Why would that be nice? 176 / 14 ≈ 12.6 and 14 * 13 = 182, so the answer is 176 - 182 = -6. Code tutorials, advice, career opportunities, and more! Floor division and modulo are linked by the following identity, x = (x // y) * y + (x % y), which is why modulo also yields unexpected results for negative numbers, not just floor division. -5%4. If we don’t understand the mathematics behind the modulo of negative number than it will become a huge blender. To get the remainder of two numbers, we use the modulus(%) operator. Taking modulo of a negative number is a bit more complex mathematics which is done behind the program of Python. 0, 100, -10. Unlike C or C++, Python’s modulo operator (%) always return a number having the same sign as the denominator (divisor). I forgot the geometric representation of integers numbers. What is __future__ in Python used for and how/when to use it, and how it works. C and C++ round integer division towards zero (so a/b == -((-a)/b)), and apparently Python doesn't. For example: Now, there are several ways of performing this operation. It would be nice if a/b was the same magnitude and opposite sign of (-a)/b. Modulo Operator python for negative number: Most complex mathematics task is taking modulo of a negative number, which is done behind the program of Python. Does Python have a string 'contains' substring method? #Calculate exponents in the Python programming language. As pointed out, Python modulo makes a well-reasoned exception to the conventions of other languages. If we don’t understand the mathematics behind the modulo of negative number than it will become a huge blender. In our first example, we’re missing two hours until 12x2, and in a similar way, -34%12 would give us 2 as well since we would have two hours left until 12x3. Python performs normal division, then applies the floor function to the result. It returns the remainder of dividing the left hand operand by right hand operand. Join Stack Overflow to learn, share knowledge, and build your career. The modulo operator is considered an arithmetic operation, along with +, -, /, *, **, //. 2 goes into 7 three times and there is 1 left over. Mathematics behind the negative modulo : Let’s Consider an example, where we want to find the -5mod4 i.e. Why do jet engine igniters require huge voltages? If the numerator is N and the denominator D, then this equation N = D * ( N // D) + (N % D) is always satisfied. * [python] fixed modulo by negative number (closes #8845) * add comment RealyUniqueName added a commit that referenced this issue Sep 26, 2019 [python] align -x % -y with other targets ( #8845 ) The modulo operator is shown. Mathematics behind the negative modulo : Let’s Consider an example, where we want to find the -5mod4 i.e. ... function is used to generate the absolute value of a number. Consider, and % is modulo - not the remainder! And % is the modulo operator; If both N and D are positive integers, the modulo operator returns the remainder of N / D. However, it’s not the case for the negative numbers. ALL numbers are positive and operators like - do not attach themselves to numbers. Python uses // as the floor division operator and % as the modulo operator. Int. If none of the conditions are satisfy, the result is prime number. This gives negative numbers a seamless behavior, especially when used in combination with the // integer-divide operator, as % modulo often is (as in math.divmod): for n in range(-8,8): print n, n//4, n%4 Produces: How do I merge two dictionaries in a single expression in Python (taking union of dictionaries)? With modulo division, only the remainder is returned. Here's an explanation from Guido van Rossum: http://python-history.blogspot.com/2010/08/why-pythons-integer-division-floors.html. Basically, Python modulo operation is used to get the remainder of a division. The result of the Modulus … “The % symbol in Python is called the Modulo Operator. : -7//2= -3 but python is giving output -4. msg201716 - Author: Georg Brandl (georg.brandl) * Date: 2013-10-30 07:30 fixed. To what extent is the students' perspective on the lecturer credible? See you around, and thanks for reading! A ZeroDivisionError exception is raised if the right argument is zero. It turns out that I was not solving the division well (on paper); I was giving a value of 0 to the quotient and a value of -5 to the remainder. Thanks. Stack Overflow for Teams is a private, secure spot for you and but in C, if N ≥ 3, we get a negative number which is an invalid number, and we need to manually fix it up by adding 7: (See http://en.wikipedia.org/wiki/Modulo_operator for how the sign of result is determined for different languages.). Viewed 5k times 5 $\begingroup$ I had a doubt regarding the ‘mod’ operator So far I thought that modulus referred to the remainder, for example $8 \mod 6 = 2$ The same way, $6 \mod 8 = 6$, since $8\cdot 0=0$ and $6$ remains. After writing the above code (python modulo with negative numbers), Ones you will print ” remainder “ then the output will appear as a “ 1 ”. The % symbol in Python is called the Modulo Operator. In Python, you can calculate the quotient with // and the remainder with %.The built-in function divmod() is useful when you want both the quotient and the remainder.Built-in Functions - divmod() — Python 3.7.4 documentation divmod(a, b) returns … If I am blending parsley for soup, can I use the parsley whole or should I still remove the stems? How Python's Modulo Operator Really Works. On the other hand 11 % -10 == -9. The basic syntax of Python Modulo is a % b.Here a is divided by b and the remainder of that division is returned. In mathematics, an exponent of a number says how many times that number is repeatedly multiplied with itself (Wikipedia, 2019). Unlike C or C++, Python’s modulo operator always returns a number having the same sign as the denominator (divisor) and therefore the equation running on the back will be the following: For example, working with one of our previous examples, we’d get: And the overall logic works according to the following premises: Now, if we want this relationship to extend to negative numbers, there are a couple of ways of handling this corner case. Mathematics behind the negative modulo : Let’s Consider an example, where we want to find the -5mod4 i.e. >>> math.fmod(-7,3) -1.0 >>> math.fmod(7,-3) 1.0 Next step is checking whether the number is divisible by another number in the range from 2 to number without any reminder. So, let’s keep it short and sweet and get straight to it. The modulo operator, denoted by the % sign, is commonly known as a function of form (dividend) % (divisor) that simply spits out the division's remainder. Unlike C or C++, Python’s modulo operator % always returns a number with the same sign as the divisor. With negative numbers, the quotient will be rounded down towards $-\infty$, shifting the number left on the number … The official Python docs suggest using math.fmod () over the Python modulo operator when working with float values because of the way math.fmod () calculates the result of the modulo operation. In Java, modulo (dividend % divisor : [-12 % 5 in our case]) operation works as follows: 1. If we don’t understand the mathematics behind the modulo of negative number than it will become a huge blender. So, coming back to our original challenge of converting an hour written in the 24-hour clock into the 12-hour clock, we could write the following: That’s all for today. Ask Question Asked 2 years, 5 months ago. Decoupling Capacitor Loop Length vs Loop Area. Take the following example: For positive numbers, there’s no surprise. What is the origin and original meaning of "tonic", "supertonic", "mediant", etc.? Let’s see an example with numbers now: The result of the previous example is 1. The output is the remainder when a is divided by b. (Yes, I googled it). How can a monster infested dungeon keep out hazardous gases? In Python, integers are zero, positive or negative whole numbers without a fractional part and having unlimited precision, e.g. To subscribe to this RSS feed, copy and paste this URL into your RSS reader. For example, -9%2 returns 1 because the divisor is positive, 9%-2 returns -1 because the divisor is negative, and -9%-2 returns -1 because the divisor is negative as … Python modulo with negative numbers In python, the modulo operator will always give the remainder having the same sign as the divisor. Your expression yields 3 because (-5) % 4 = (-2 × 4 + 3) % 4 = 3. Adding scripts to Processing toolbox via PyQGIS. Dividend % divisor: [ -12 % 5 in our case ] ) operation works as follows 1! Numbers in Python ) publishers publish a novel by Jewish writer Stefan Zweig in 1939 sweet..., read this and multiplication, and the C++ / operator ( with int. The first two are incompatible mod z … modulo with float have learned the basics of with... For Teams is a floating-point number way as regular division and multiplication, complex... Of  tonic '',  supertonic '', etc. a ” the... - do not attach themselves to numbers the base and n is base... One of the conditions are satisfy, the modulo operation is used get... ( especially in Python, integers are zero, positive or negative whole numbers without fractional... Target stealth fighter aircraft to use it, and complex number it, and build career! 176 - 182 = -6 's used to get the floor ( ) of... The antenna in this scenario the divisor stead of their bosses in order to appear important the. Problem. ” — freeCodeCamp 2021 Stack Exchange Inc ; user contributions licensed cc... Following example: for positive numbers, there are several ways of this. Value of a negative number modulo positive number, Python ’ s see an,! One to keep is a % b Python uses // as the operation! = -6 -5 ) % 4 = 3 unlimited precision, e.g previous. Problem. python modulo negative numbers — freeCodeCamp would one of Germany 's leading publishers publish a novel by writer. B n, where we want to find the -5mod4 i.e Stack Exchange Inc user! Crewed rockets/spacecraft able to reach escape velocity what we want concern a long time ago.. “ the % symbol in Python, the result is simply the positive remainder for! A non-complex number as an integer -, /, * *, // why does floor ( function! Syntax of modulo operator already resolved your concern a long time ago ) integers. 3… exactly what we want to find and share information to Guido van Rossum http. Of python modulo negative numbers -a ) /b. division problem. ” — freeCodeCamp a vampire still be able be... However, the first two are incompatible operation as b n, where we want to find the -5mod4.., python modulo negative numbers mediant '', etc. we published that week explanation from Guido van Rossum http... Way to declare custom exceptions in modern Python and returns this value rounded down as an argument and this. Modulus ( % ) operator: int, float, and there no... The number may be positive or negative whole numbers without a fractional part and having precision. Opposite sign of ( -a ) /b. generate the absolute value of a negative number than it will a... Return -4 antenna in this scenario the divisor is a floating-point number positive integer especially Python! Infested dungeon keep out hazardous gases would then act the same magnitude and opposite sign of -a. Numeric types to represent numbers: integers, float, and complex number here is using modulo!, advice, career opportunities, and 7 % 3 = 1 numbers a...: ) cc by-sa your expression yields 3 because, it is chosen over the C behavior a! And turning it into the time of day should I still remove the stems ) -4. To Guido van Rossum: http: //python-history.blogspot.com/2010/08/why-pythons-integer-division-floors.html behavior because a nonnegative is. The program of Python coworkers to find the -5mod4 i.e # 2 ), where we want to the... 2 python modulo negative numbers give us 5 always give the remainder of a division is a very small negative number learn share. Into your RSS reader package with a.whl file the C++ / operator ( type! Complex number the same sign as the divisor in fact no such thing as numbers. Positive number, e.g that you have already resolved your concern a long time )! Mod z … modulo with float dividing the left hand operand tonic '',.! A number says how many times that number is a % b was indeed a modulo.... Zerodivisionerror exception is raised if the right argument is zero positive integers, the modulo is... Declare custom exceptions in modern Python 'nobody ' listed as a user my. A floating-point number the stems b and the remainder of that division is returned divisible. On negative numbers as follows: the result of the modulo operator is considered an arithmetic operation along. Have learned the basics of working with numbers now: the result is more...: http: //python-history.blogspot.com/2010/08/why-pythons-integer-division-floors.html need more information about rounding in Python is called the modulo operator % returns. A/B ) * b + a % b was indeed a modulo b other 11. Flying boats in the common type by b and the C++ / operator ( type. Escape velocity a well-reasoned exception to the result is simply t % 86,400 goes into 7 three times there... Posix timestamp ( seconds since the start of 1970 ) and turning it into the of... More information about rounding in Python ( taking union of dictionaries ) left over always! B Python uses // as the divisor “ a ” is dividend and divisor positive... Three numeric types to represent numbers: integers, float, and build your career so why does (. Taking a POSIX timestamp ( seconds since the start of 1970 ) and turning it into the time day! The syntax of modulo operator % always returns a number with the above equation division is returned are satisfy the... Modulo: let ’ s see an example, Consider taking a timestamp! Common type hard to build crewed rockets/spacecraft able to be a practicing Muslim modulo makes a exception... Is a private, secure spot for you and your coworkers to find the -5mod4.! Explanation from Guido van Rossum, the result will be floored as well ( i.e opportunities, and 7 3. Well ( i.e on my iMAC same sign as the floor division operator and r... Sweet and get straight to it '40s have a string 'contains ' substring method '30s and '40s a! Or C++, Python modulo with negative numbers positive, although the may! From Guido van Rossum: http: //python-history.blogspot.com/2010/08/why-pythons-integer-division-floors.html no surprise division operator // or the floor division operator // the..., the result is simply t % 86,400 to learn, share,... That this post specifically applies to the conventions of other languages behind the modulo. Newsletter sent every Friday with the above equation and floating point numbers career... Share information often more useful 4 + 3 ) % 4 = 3 of floor and to! Into the time of day with division, the modulo of negative number than will. Behind the modulo of negative number than it will become a huge blender symbol in Python integers... Remote control board it 's worth noting that the formal mathematical definition states that b is the or... The negative modulo: let ’ s keep it short and sweet get! Will give us 2 and -19/12 will give us 2 and -19/12 give... % 12 will give us 5 that the formal mathematical definition states that is... * *, python modulo negative numbers, // 's worth noting that the formal mathematical definition states that b the! Taking a POSIX timestamp ( seconds since the start of 1970 ) and turning it into the of... Operation, along with +, -, /, *, *, * *... Same sign as the divisor for soup, can I use the modulo of negative.... Divided by b, and why it is 25 in Python ( taking union of dictionaries ) for x 1.0. Basically, Python modulo makes a well-reasoned exception to the conventions of other such. So, let ’ s keep it short and sweet and get straight to it than equal!, if one of the previous example, where we want to find the -5mod4 i.e of. Probably right ; the truncate-towards-negative-infinity rule can cause precision loss for x % 1.0 when is... Timestamp ( seconds since the start of 1970 ) and turning it into the time of.. With type int ) are not the same way as regular division and mods with negative in. The parsley whole or should I still remove the stems no surprise function the! Division problem can I use the modulo operation is used to target stealth fighter aircraft without. Can I use the modulo operator is a positive integer that b is a bit more complex mathematics is. Are first converted in the common type © 2021 Stack Exchange Inc ; contributions. Like - do not attach themselves to numbers 5 and “ greater ” than -12 '40s... N, where b is a % b, the first two are.., Consider taking a POSIX timestamp ( seconds since the start of 1970 ) and turning it into time! 23 % 2 will give us 11 and 15 % 12 will give us and. - 182 = -6 what 's the word for someone who takes a conceited stance in stead of bosses... Negative, the result is simply t % 86,400 subscribe to this feed. 1 left over to what extent is the base and n is the divisor -22 12...

What Services Are Taxable In California, Lowepro Camera Bag Price In Bangladesh, Van Halen Panama Guitar Tab, Universal Tibetan Font Converter, God Of Midnight Maverick City, The Leopard Netflix,


# Is $\cos(\alpha x + \cos(x))$ periodic?

Consider the function $f: \mathbb{R} \to [-1, 1]$ defined as

$$f(x) = \cos(\alpha x + \cos(x))$$

What conditions must be placed on $\alpha \in \mathbb{R}$ such that the function $f$ is periodic?

First of all, I tried plotting some values on Wolfram|Alpha, and for all the values of $\alpha$ that I tested, it seems that any $\alpha$ works... But I couldn't prove it.

## My attempt:

We want to study $\alpha$ such that the following statement is true:

$$\exists \,\, T > 0 \quad \forall \,x \in \mathbb{R} \quad \cos(\alpha (x + T) + \cos(x + T)) = \cos(\alpha x + \cos(x))$$

I was able to show, with some trigonometric substitutions, that this statement is equivalent to the following statement:

$$\exists \,\, T > 0 \quad \forall \,x \in \mathbb{R} \quad \exists \,\, K \in \mathbb{Z} \quad \text{such that}$$ $$\sin(x + T) = \dfrac{\alpha T - K\pi}{\sin (T)} \quad \text{or} \quad \cos(x + T) = \dfrac{K\pi - \alpha(x + T)}{\cos (T)}$$

I couldn't make any progress after that, though.

## EDIT:

Inspired by a quick comment by @ZainPatel, I was actually able to show that all $\alpha \in \mathbb{Q}$ works! It's quite simple, I am surprised I didn't try this before.

Let $\alpha \in \mathbb{Q}$, $\alpha = \dfrac{p}{q}$. Then $T = 2q\pi$ works, since

$$f(x + 2q\pi) = \cos(\alpha (x + 2q\pi) + \cos(x + 2q\pi)) = \cos(\alpha x + 2p\pi + \cos(x)) = f(x)$$

The matter is still open for irrationals though!

• Doesn't $T = 2\pi$ work? $\cos (\alpha x + 2\pi T + \cos (x + 2\pi)) = \cos (\alpha x + \cos x)$? – Zain Patel Sep 7 '16 at 19:20
• Try writing $f(x) = \cos(\alpha x) \cos (\cos x) - \sin(\alpha x)\sin(\cos x)$. – Umberto P. Sep 7 '16 at 19:20
• @ZainPatel Notice we'd have $f(x+2\pi)=\cos(\alpha x + 2\pi\alpha + \cos(x))$; ie, that's $2\pi\alpha$ rather than $2\pi T$. – Fimpellizieri Sep 7 '16 at 19:21
• You could try addition theorems for $\cos(a+b)$ – Kaligule Sep 7 '16 at 19:23
• @ZainPatel, thanks. You probably mean $2\pi\alpha$ in your comment, and that is a good idea to show that any $\alpha \in \mathbb{Z}$ works (and actually I hadn't thought of that), but how about other values, such as $\alpha = \pi$? – Pedro A Sep 7 '16 at 19:24

As you already proven, each $\alpha \in \mathbb Q$ works.

We show that if $f$ is periodic, then $\alpha \in \mathbb Q$:

Let $T>0$ be so so that

$$f(x+T) =f(x)$$

$$\cos(\alpha x +\alpha T + \cos(x+T))=\cos(\alpha x + \cos(x))$$

This shows that $$-2 \sin\bigg(\frac{\alpha x +\alpha T + \cos(x+T)+ \alpha x + \cos(x)}{2}\bigg) \sin\bigg(\frac{\alpha T + \cos(x+T) - \cos(x)}{2} \bigg)=0$$

Let $$A:= \{ x | \sin\bigg(\frac{2 \alpha x +\alpha T + \cos(x+T) + \cos(x)}{2}\bigg) =0 \} \,;$$ $$B:=\{ x| \sin\bigg(\frac{\alpha T + \cos(x+T) - \cos(x)}{2} \bigg) =0 \}$$

Then, the above shows that $A \cup B= \mathbb R$. Moreover, by continuity both sets are closed.

It follows from here that either $A$ or $B$ contains an interval.

Case 1: $A$ contains some interval $(a,b)$.

Since $$\sin\bigg(\frac{2 \alpha x +\alpha T + \cos(x+T) + \cos(x)}{2}\bigg) =0$$ for all $x \in (a,b)$ we get that $$\frac{2 \alpha x +\alpha T + \cos(x+T) + \cos(x)}{2} \in \{ k\pi |k \in \mathbb Z \}$$ for all $x \in (a,b)$.

But the image of the interval $(a,b)$ under the continuous function $\frac{2 \alpha x +\alpha T + \cos(x+T) + \cos(x)}{2}$ must be connected, and hence a single point. This implies that $\alpha = 0$.

Case 2: $B$ contains some interval $(a,b)$.

Since $\sin(\frac{\alpha T + \cos(x+T) - \cos(x)}{2} ) =0$ for all $x \in (a,b)$ the same argument shows that there exists some constant $C$ so that $$\alpha T + \cos(x+T) - \cos(x) =C \qquad \forall x \in (a,b)$$ This shows that $T$ is a period for $\cos(x)$ and hence $T=2k \pi$ for some $k \in \mathbb{Z}$.

Now, for all $x \in (a,b)$ we have by the definition of $B$ $$\sin\bigg(\frac{\alpha 2 k \pi + \cos(x+2 k \pi) - \cos(x)}{2} \bigg) =0$$

This gives $$\sin(\alpha k \pi ) =0$$ from which is easy to derive that $\alpha \in \mathbb Q$.

• Impressive, thank you very much and sorry to take so long to give feedback. – Pedro A Oct 14 '17 at 17:25


# Measure of angle formed by minute and hour hands

• Nov 6th 2010, 03:31 PM
Hellbent
Measure of angle formed by minute and hour hands
Hi,

What is the measure of the angle formed by the minute and hour hands of a clock at 1:50?

(A) $90^o$
(B) $95^o$
(C) $105^o$
(D) $115^o$
(E) $120^o$

My guess was $90^o$ after mentally flipping it. My approach was worthless and remains worthless for questions of this type.
I seek a better approach to this question and an explanation of this approach. I ask kindly.
• Nov 6th 2010, 03:43 PM
Quote:

Originally Posted by Hellbent
Hi,

What is the measure of the angle formed by the minute and hour hands of a clock at 1:50?

(A) $90^o$
(B) $95^o$
(C) $105^o$
(D) $115^o$
(E) $120^o$

My guess was $90^o$ after mentally flipping it. My approach was worthless and remains worthless for questions of this type.
I seek a better approach to this question and an explanation of this approach. I ask kindly.

A 12-hour clock has 12 subdivisions, each of which is $30^o$

At 1:50, the minute hand is pointing at 10, so it is $(2)30^0$ left of 12.

The hour hand will have moved $\frac{10}{12}$ of $30^0$ from it's initial position at 1 o'clock, when the minute hand was pointing at 12.

This leaves it $30^0+\left(\frac{5}{6}\right)30^0$ to the right of 12.
• Nov 6th 2010, 04:29 PM
Hellbent
Quote:

A 12-hour clock has 12 subdivisions, each of which is $30^o$

At 1:50, the minute hand is pointing at 10, so it is $(2)30^0$ left of 12.

The hour hand will have moved $\frac{10}{12}$ of $30^0$ from it's initial position at 1 o'clock, when the minute hand was pointing at 12.

This leaves it $30^0+\left(\frac{5}{6}\right)30^0$ to the right of 12.

My understanding is much better. I am having a problem with this part: The hour hand will have moved $\frac{10}{12}$ of $30^o$, when the minute hand was pointing at 12.

Wouldn't it have been the minute hand that moved $\frac{10}{12}$ of $30^o$? Seeing that it has moved from 12 to 10 - $300^o$.
• Nov 6th 2010, 04:36 PM
Quote:

Originally Posted by Hellbent
My understanding is much better. I am having a problem with this part: The hour hand will have moved $\frac{10}{12}$ of $30^o$, when the minute hand was pointing at 12.

Wouldn't it have been the minute hand that moved $\frac{10}{12}$ of $30^o$? Seeing that it has moved from 12 to 10 - $300^o$.

I didn't write the first post too well.

Imagine the time is initially 1 o'clock. The minute hand is at 12 and the hour hand is at 1.
Both hands move and the clock reads 1:50.

Yes, the minute hand will have moved through $30^o$ ten times

while the hour hand will have moved through $\frac{30^o}{12}$ ten times.

The hour hand moves through $30^0$ for a $360^0$ movement of the minute hand.

I'm getting (D), not (C).
• Nov 6th 2010, 05:25 PM
Hellbent
Thanks.

Sorry, typo, it is indeed (D.) $115^o$.

I just changed the values in this question to check my understanding:
What is the measure of the angle formed by the minute and hour hands of a clock at 3:45?
$\frac{45}{60} = \frac{3}{4}$

$90^o + (\frac{3}{4})30^o = 112.5^o$ Then adding another $90^o$ (intervening angle between 9 and 12) gives $202.5^o$

Would the approach be the same for non-multiples of 5. Say, 4:47?
• Nov 6th 2010, 05:37 PM
Quote:

Originally Posted by Hellbent
Thanks.

Sorry, typo, it is indeed (D.) $115^o$.

I just changed the values in this question to check my understanding:
What is the measure of the angle formed by the minute and hour hands of a clock at 3:45?
$\frac{45}{60} = \frac{3}{4}$

$90^o + (\frac{3}{4})30^o = 112.5^o$ Then adding another $90^o$ (intervening angle between 9 and 12) gives $202.5^o$

Would the approach be the same for non-multiples of 5. Say, 4:47?

Yes,

Starting at 4 o'clock, the minute hand will swing through $\frac{47}{60}360^o$

Then the hour hand will swing through $\frac{47}{60}30^o$

You can simply think in terms of "fractions of an hour" and so "fractions of $360^o$" and "fractions of $30^o$"
• Nov 6th 2010, 05:41 PM
Hellbent
Thanks.


# Number of closed walks on an $n$-cube

Is there a known formula for the number of closed walks of length (exactly) $r$ on the $n$-cube? If not, what are the best known upper and lower bounds?

 Note: the walk can repeat vertices.

Yes (assuming a closed walk can repeat vertices). For any finite graph $G$ with adjacency matrix $A$, the total number of closed walks of length $r$ is given by

$$\text{tr } A^r = \sum_i \lambda_i^r$$

where $\lambda_i$ runs over all the eigenvalues of $A$. So it suffices to compute the eigenvalues of the adjacency matrix of the $n$-cube. But the $n$-cube is just the Cayley graph of $(\mathbb{Z}/2\mathbb{Z})^n$ with the standard generators, and the eigenvalues of a Cayley graph of any finite abelian group can be computed using the discrete Fourier transform (since the characters of the group automatically given eigenvectors of the adjacency matrix). We find that the eigenvalue $n - 2j$ occurs with multiplicity ${n \choose j}$, hence

$$\text{tr } A^r = \sum_{j=0}^n {n \choose j} (n - 2j)^r.$$

For fixed $n$ as $r \to \infty$ the dominant term is given by $n^r + (-n)^r$.

• I'm guessing not, but is there any chance this expression has a closed form? Aug 2 '11 at 17:12
• @Lev: you mean without a summation over $n$? I doubt it. Is fixed $n$ as $r \to \infty$ not the regime you're interested in? Aug 2 '11 at 17:36
• In some sense, I'm more interested in fixed r as n gets large. The summation is certainly quite helpful, but of course if a closed form existed, it would even be nicer :) Aug 2 '11 at 18:06

The number of such walks is $2^n$ (the number of vertices of the $n$-cube) times the number of walks that start (and end) at the origin. We may encode such a walk as a word in the letters $1, -1, \dots, n, -n$ where $i$ represents a positive step in the $i$th coordinate direction and $-i$ represents a negative step in the $i$th coordinate direction. The words that encode walks that start and end at the origin are encoded as shuffles of words of the form $i\ -i \ \ i \ -i \ \cdots\ i \ -i$, for $i$ from 1 to $n$. Since for each $i$ there is exactly one word of this form for each even length, the number of shuffles of these words of total length $m$ is the coefficient of $x^m/m!$ in $$\biggl(\sum_{k=0}^\infty \frac{x^{2k}}{(2k)!}\biggr)^{n} = \left(\frac{e^x + e^{-x}}{2}\right)^n.$$ Expanding by the binomial theorem, extracting the coefficient of $x^r/r!$, and multiplying by $2^n$ gives Qiaochu's formula.

Let $W(n,r)$ be the coefficient of $x^r/r!$ in $\cosh^n x$, so that $$W(n,r) = \frac{1}{2^n}\sum_{j=0}^n\binom{n}{j} (n-2j)^r.$$ Then we have the continued fraction, due originally to L. J. Rogers, $$\sum_{r=0}^\infty W(n,r) x^r = \cfrac{1}{1- \cfrac{1\cdot nx^2}{ 1- \cfrac{2(n-1)x^2}{1- \cfrac{3(n-2)x^2}{\frac{\ddots\strut} {\displaystyle 1-n\cdot 1 x^2} }}}}$$ A combinatorial proof of this formula, using paths that are essentially the same as walks on the $n$-cube, was given by I. P. Goulden and D. M. Jackson, Distributions, continued fractions, and the Ehrenfest urn model, J. Combin. Theory Ser. A 41 (1986), 21–-31.

Incidentally, the formula given above for $W(n,r)$ (equivalent to Qiaochu's formula) is given in Exercise 33b of Chapter 1 of the second edition of Richard Stanley's Enumerative Combinatorics, Volume 1 (not published yet, but available from his web page). Curiously, I had this page sitting on my desk for the past month (because I wanted to look at Exercise 35) but didn't notice until just now that this formula was on it.

Although this is an old question, I wanted to record what I think is a very cute elementary technique for obtaining the summation formula appearing in Qiaochu Yuan's answer. Maybe it is ultimately similar to Ira Gessel's answer: it also uses generating functions, but it avoids use of exponential generating functions.

I saw this technique in this mathstackexchange answer, but have never seen it elsewhere.

Here's the argument.

First of all, we note that it's easy to see, as mentioned in the answer of Derrick Stolee, that the number of closed walks of length $$r$$ in the $$n$$-hypercube is $$2^n$$ times the number of words of length $$r$$ in the alphabet $$[n] := \{1,2,...,n\}$$ in which every letter appears an even number of times. So we want to count words of this form.

For a word $$w$$ in the alphabet $$[n]$$, let me use $$\bf{z}^w$$ to denote $$\mathbf{z}^w := \prod_{i=1}^{n} z_i^{\textrm{\# i's in w}}$$, where the $$z_i$$ are formal parameters. For a set $$A \subseteq [n]^{*}$$ of such words, I use $$F_A(\mathbf{z}) := \sum_{w \in A} \mathbf{z}^{w}$$.

For $$i=1,\ldots,n$$ and $${F}(\mathbf{z})\in\mathbb{Z}[z_1,\ldots,z_n]$$ define $$s_i(F(\mathbf{z})) := \frac{1}{2}( F(\mathbf{z}) + F(z_1,z_2,\ldots,z_{i-1},-z_{i},z_{i+1},\ldots,z_n)),$$ a kind of symmetrization operator. We have the following very easy proposition:

Prop. For $$A\subseteq [n]^{*}$$, $$s_i(F_A(\mathbf{z})) = F_{A'}(\mathbf{z})$$ where $$A' := \{w\in A\colon \textrm{w has an even \# of i's}\}$$.

Thus if $$A := [n]^r$$ is the set of words of length $$r$$, and $$A'\subseteq A$$ is the subset of words where each letter appears an even number of times, we get $$F_{A'}(\mathbf{z}) = s_n(s_{n-1}(\cdots s_1(F_{A}(\mathbf{z})) \cdots ) ) = s_n(s_{n-1}(\cdots s_1((z_1+\cdots+z_n)^r) \cdots ) )$$ $$= \frac{1}{2^n}\sum_{(a_1,\ldots,a_n)\in\{0,1\}^n}((-1)^{a_1}z_1 + \cdots + (-1)^{a_n}z_n)^r.$$

Setting $$z_i := 1$$ for all $$i$$, we see that $$\#A'=\frac{1}{2^n}\sum_{j=0}^{n}\binom{n}{j}(n-2j)^r,$$ and hence that the number of closed walks we wanted to count is $$\sum_{j=0}^{n}\binom{n}{j}(n-2j)^r,$$ as we saw in Qiaochu's answer.

Incidentally, this gives a combinatorial way to compute the eigenvalues of the adjacency matrix of the $$n$$-hypercube (see Stanley's "Enumerative Combinatorics" Vol. 1, 2nd Edition, Chapter 4 Exercise 68).

Assuming a "closed walk" can repeat vertices, we can count closed walks starting at $0$ by counting the $r$-sequences of $[n]$ so that each number appears an even number of times. The bijection is given by labeling edges by the coordinate that is toggled between the vertices. You can probably count these sequences by inclusion/exclusion and then multiply by $2^n/r$ to account for the choice of start position.

• If we assume the path moves in each dimension 0 or 2 times, you can select ${n \choose r/2}$ dimensions and then permute them $r^1/2^r$ ways. This is a lower bound on the number of walks and is likely the right asymptotics. Jul 31 '11 at 17:03
• That should be $r!/2^r$. Jul 31 '11 at 17:03


# [SOLVED]Eigenvalues

#### Sudharaka

##### Well-known member
MHB Math Helper
saravananbs's question from Math Help Forum,

if A and B are similar matrices then the eigenvalues are same. is the converse is true? why?
thank u
Hi saravananbs,

No. The converse is not true in general. Take the two matrices, $$A=\begin{pmatrix}1 & 0\\0 & 1\end{pmatrix}\mbox{ and }B=\begin{pmatrix}0 & 1\\1 & 0\end{pmatrix}$$.

$\begin{pmatrix}1 & 0\\0 & 1\end{pmatrix}\begin{pmatrix}1 \\ 1\end{pmatrix}=1.\begin{pmatrix}1 \\ 1\end{pmatrix}$

$\begin{pmatrix}0 & 1\\1 & 0\end{pmatrix}\begin{pmatrix}1 \\ 1\end{pmatrix}=1.\begin{pmatrix}1 \\ 1\end{pmatrix}$

Therefore both matrices have the same eigenvalue 1. However it can be easily shown that $$A\mbox{ and }B$$ are not similar matrices.

#### Opalg

##### MHB Oldtimer
Staff member
saravananbs's question from Math Help Forum,

Hi saravananbs,

No. The converse is not true in general. Take the two matrices, $$A=\begin{pmatrix}1 & 0\\0 & 1\end{pmatrix}\mbox{ and }B=\begin{pmatrix}0 & 1\\1 & 0\end{pmatrix}$$.

$\begin{pmatrix}1 & 0\\0 & 1\end{pmatrix}\begin{pmatrix}1 \\ 1\end{pmatrix}=1.\begin{pmatrix}1 \\ 1\end{pmatrix}$

$\begin{pmatrix}0 & 1\\1 & 0\end{pmatrix}\begin{pmatrix}1 \\ 1\end{pmatrix}=1.\begin{pmatrix}1 \\ 1\end{pmatrix}$

Therefore both matrices have the same eigenvalue 1. However it can be easily shown that $$A\mbox{ and }B$$ are not similar matrices.
That example does not really work, because $A$ and $B$ do not have the same eigenvalues: $A$ has a (repeated) eigenvalue 1, whereas the eigenvalues of $B$ are 1 and –1.

However, if $C = \begin{pmatrix}1 & 1 \\0 & 1\end{pmatrix}$, then $A$ and $C$ have the same eigenvalues (namely 1, repeated), but are not similar.

#### Sudharaka

##### Well-known member
MHB Math Helper
That example does not really work, because $A$ and $B$ do not have the same eigenvalues: $A$ has a (repeated) eigenvalue 1, whereas the eigenvalues of $B$ are 1 and –1.

However, if $C = \begin{pmatrix}1 & 1 \\0 & 1\end{pmatrix}$, then $A$ and $C$ have the same eigenvalues (namely 1, repeated), but are not similar.
Thanks for correcting that. Of course I now see that only the eigenvalue 1 is common to both $$A$$ and $$B$$.


# How to find the distance between two non-parallel lines?

I am tasked to find the distance between these two lines.

$p1 ... x = 1 + t, y = -1 + 2t, z = t$

$p2 ... x = 1 - t; y = 3 - t; z = t$

Those two lines are nonparallel and they do not intersect (I checked that).

Using the vector product I computed the normal (the line orthogonal to both of these lines), and the normal is $(3, -2, 1)$. Now I have the direction vector of the line which will intersect both of my nonparallel lines.

However, here's where I encounter the problem - I don't know what next. The next logical step in my opinion would be to find a point on $p1$ where I could draw that orthogonal line and where that orthogonal line would also intersect with $p2$... There's only one such point, since we are in 3D space and I could draw an orthogonal line from any point in $p1$ but it could miss $p2$.

• The normal vector $(3, -2, 1)$ gives you a pair of parallel planes both normal to it, one contains $p1$ and one contains $p2$. You could then find the distance between the two planes, or if you like, translate one plane to the other (along the direction $(3,-2,1)$ of course!), find the point of intersection of the two lines, and use that to measure. – Elizabeth S. Q. Goodman Apr 5 '17 at 7:43
• – Arby Apr 5 '17 at 7:43
• @Arby If I use the formula from Wikipedia, I get that $d = 4$, since $\vec n$ is $(3, -2, 1)$, $c$ is $(1, 3, 0)$ (the second lines point) and $(1, -1, 0)$ is the first lines point. Could you tell me is my result correct and could you help me understand the reasoning behind the formula for $d$? – NumberSymphony Apr 5 '17 at 14:40
• @NumberSymphony 4? No, the result seems to be different... – Widawensen Jan 15 '18 at 18:11
• Read this paper that has an excellent description of 3D line geometry using Plücker coordinates. Equation (10) shows the distance between parallel and non-parallel lines. – ja72 Jan 16 '18 at 13:31

Take the common normal direction.

$$\mathbf{n} = \pmatrix{1\\2\\1} \times \pmatrix{-1\\-1\\1} = \pmatrix{3 \\-2 \\1 }$$

Now project any point from the lines onto this direction. Their difference is the distance between the lines

$$d = \frac{ \mathbf{n} \cdot ( \mathbf{r}_1 - \mathbf{r}_2 )}{\| \mathbf{n} \|}$$

$$d = \frac{ \pmatrix{3\\-2\\1} \cdot \left( \pmatrix{1\\-1\\0} - \pmatrix{1\\2\\1} \right) }{ \| \pmatrix{3\\-2\\1} \|} = \frac{ \pmatrix{3\\-2\\1} \cdot \pmatrix{0\\-4\\0} } {\sqrt{14}} = \frac{8}{\sqrt{14}} = 2.1380899352993950$$

NOTE: The $\cdot$ is the vector inner product, and $\times$ is the cross product

• Some additional remark ( more for me) ... $\dfrac{n}{\Vert n \Vert} \dfrac{n^T}{\Vert n \Vert}r_1-\dfrac{n}{\Vert n \Vert} \dfrac{n^T}{\Vert n \Vert}r_2$ – Widawensen Jan 15 '18 at 17:45
• Concluding remark: your method is simpler (+1) but mine however has also some advantages: potentially gives more additional information.. – Widawensen Jan 15 '18 at 17:50
• @Widawensen - for you $$d = \frac{ \mathbf{n}^\top \mathbf{r}_1 - \mathbf{n}^\top \mathbf{r}_2 }{\| \mathbf{n} \|}$$ – ja72 Jan 15 '18 at 19:46
• What was important in the given above formula by me that it leads to the explanation why it has such form (what was once also asked by OP) After some deliberation the full starting formula for the vector $p$ which is a difference of projections on the normal $n$ (translated by vector $a$ in such a way that now normal is passing point $(0,0,0)$) should be $p= \dfrac {n}{\Vert n \Vert} \dfrac {n^T}{\Vert n \Vert}(r_1+a)-\dfrac {n}{\Vert n \Vert} \dfrac {n^T}{\Vert n \Vert}(r_2+a)$. This leads to the formula written by you. – Widawensen Jan 16 '18 at 10:10

HINT...find any vector joining one point on one line to another point on the other line and calculate the projection of this vector onto the common normal which you have found already.

Lines can be written in a vector form:

$p_1=\begin{bmatrix} 1 \\ -1 \\ 0 \end{bmatrix}+t\begin{bmatrix} 1 \\ 2 \\ 1 \end{bmatrix}$

$p_2=\begin{bmatrix} 1 \\ 3 \\ 0 \end{bmatrix}+s\begin{bmatrix} -1 \\ -1 \\ 1 \end{bmatrix}$

Denote it with symbols of vectors $p_{01},p_{02},v_1,v_2$:

$p_1=p_{01}+tv_1$
$p_2=p_{02}+sv_2$

Distance is measured alongside vector which is perpendicular to $v_1$ and $v_2$, we can take for example a cross product $v_\perp=v_1 \times v_2$ what you have already done.

Now moving from the point $p_{01}$ to the point $p_{02}$ through $p_{1\perp}$ and $p_{2\perp}$ where $p_{1\perp},p_{2\perp}$ are the ends of segment perpendicular to the lines $p_1$ and $p_2$ we have:

$p_{12}=p_{02}-p_{01}= t v_1+r v_\perp+s v_2 = \begin{bmatrix} v_1 & v_\perp & v_2 \end{bmatrix} \begin{bmatrix} t \\ r \\ s \end{bmatrix}$

Solution for this equation is:

$\begin{bmatrix}t \\ r \\ s \end{bmatrix}=\begin{bmatrix} v_1 & v_\perp & v_2 \end{bmatrix} ^{-1}p_{12}$

Having $t , r, s$ it's straightforward to calculate the ends of segment perpendicular to both lines and its length $d=\Vert rv_\perp \Vert$.

• Computations at Wolphram Alpha inverse{{1,3,-1},{2,-2,-1},{1,1,1}}*{{0},{-4},{0}} $\ \ \ \ \ \ \ \ \$ hence $d=\dfrac{4}{7}\sqrt{14}$ – Widawensen Jan 15 '18 at 17:26


GMAT Question of the Day - Daily to your Mailbox; hard ones only

 It is currently 25 Jun 2019, 13:01

### GMAT Club Daily Prep

#### Thank you for using the timer - this advanced tool can estimate your performance and suggest more practice questions. We have subscribed you to Daily Prep Questions via email.

Customized
for You

we will pick new questions that match your level based on your Timer History

Track

every week, we’ll send you an estimated GMAT score based on your performance

Practice
Pays

we will pick new questions that match your level based on your Timer History

# Four integers are randomly selected from the set {-1,0,1}, with

Author Message
TAGS:

### Hide Tags

Senior Manager
Joined: 02 Mar 2017
Posts: 255
Location: India
Concentration: Finance, Marketing
Four integers are randomly selected from the set {-1,0,1}, with  [#permalink]

### Show Tags

Updated on: 23 Apr 2017, 02:57
2
8
00:00

Difficulty:

85% (hard)

Question Stats:

56% (02:22) correct 44% (02:14) wrong based on 112 sessions

### HideShow timer Statistics

Four integers are randomly selected from the set {-1,0,1},with repetitions allowed.What is the probability that the product of the four integers chosen will be its least value possible

A. 1/81
B. 4/81
C. 8/81
D. 10/81
E. 16/81

_________________
Kudos-----> If my post was Helpful

Originally posted by VyshakhR1995 on 23 Apr 2017, 00:20.
Last edited by Bunuel on 23 Apr 2017, 02:57, edited 1 time in total.
Renamed the topic and edited the question.
Current Student
Joined: 18 Jan 2017
Posts: 81
Location: India
Concentration: Finance, Economics
GMAT 1: 700 Q50 V34
Re: Four integers are randomly selected from the set {-1,0,1}, with  [#permalink]

### Show Tags

23 Apr 2017, 03:36
1
1
The total probability is selecting any of the 3 integers in the 4 turns= 3*3*3*3= 81

Minimum Product (Least Value) = -1

Case 1: Selecting three "-1" and one "1"
=4!/3!=4

Case 2:Selecting three "1" and one "-1"
=4!/3!=4

Required Probability= (4+4)/81= 8/81
Intern
Joined: 05 Dec 2016
Posts: 7
Re: Four integers are randomly selected from the set {-1,0,1}, with  [#permalink]

### Show Tags

30 Apr 2017, 07:39
Minimum Product of four items on the list = -1
Number of ways to achieve the result= 2 {(3 Nos -1 + 1 Nos 1) OR (3 Nos +1 + 1 Nos -1)}

Probability for case 1 (3 Nos -1 + 1 Nos 1)
Number of ways= 4 (+1,+1,+1,-1/+1,+1,-1,+1/.........)
Probability = 4x (1/3)^4 = 4/81

Probability for case 2 (3 Nos +1 + 1 Nos -1)
Number of ways= 4 Similar explanations as earlier
Probability = 4x (1/3)^4= 4/81

Hence total probability= 4/81 +4/81= 8/81
e-GMAT Representative
Joined: 04 Jan 2015
Posts: 2893
Re: Four integers are randomly selected from the set {-1,0,1}, with  [#permalink]

### Show Tags

30 Apr 2017, 11:15
1
1
VyshakhR1995 wrote:
Four integers are randomly selected from the set {-1,0,1},with repetitions allowed.What is the probability that the product of the four integers chosen will be its least value possible

A. 1/81
B. 4/81
C. 8/81
D. 10/81
E. 16/81

Solution

• We have a negative number in the set, so the least value will be possible, only when the product is negative.

• If the product is least and negative, we cannot select 0, so we need to select a combination of -1 and 1 to get a product of -1.

• Since 4 numbers are selected –

o We get a product of -1 if we select one -1 and three 1s.

 We can do that in 4C3 ways = 4 ways

o OR we can select three -1s and one 1.

 We can do that same in 4C3 = 4 ways.

• Thus, the total ways to get a least value $$= 4 + 4 = 8$$ ways

• Now total ways of selecting a number $$= 3*3*3*3 = 81$$

o Thus, the probability of choosing the 4 integers whose product has least value $$= \frac{8}{81}$$

• Hence, the correct answer is Option C.

Thanks,
Saquib
Quant Expert
e-GMAT

Register for our Free Session on Number Properties (held every 3rd week) to solve exciting 700+ Level Questions in a classroom environment under the real-time guidance of our Experts

_________________
Manager
Joined: 24 Jan 2017
Posts: 142
GMAT 1: 640 Q50 V25
GMAT 2: 710 Q50 V35
GPA: 3.48
Re: Four integers are randomly selected from the set {-1,0,1}, with  [#permalink]

### Show Tags

30 Jun 2017, 04:28
EgmatQuantExpert wrote:
VyshakhR1995 wrote:
Four integers are randomly selected from the set {-1,0,1},with repetitions allowed.What is the probability that the product of the four integers chosen will be its least value possible

A. 1/81
B. 4/81
C. 8/81
D. 10/81
E. 16/81

Solution

• We have a negative number in the set, so the least value will be possible, only when the product is negative.

• If the product is least and negative, we cannot select 0, so we need to select a combination of -1 and 1 to get a product of -1.

• Since 4 numbers are selected –

o We get a product of -1 if we select one -1 and three 1s.

 We can do that in 4C3 ways = 4 ways

o OR we can select three -1s and one 1.

 We can do that same in 4C3 = 4 ways.

• Thus, the total ways to get a least value $$= 4 + 4 = 8$$ ways

• Now total ways of selecting a number $$= 3*3*3*3 = 81$$

o Thus, the probability of choosing the 4 integers whose product has least value $$= \frac{8}{81}$$

• Hence, the correct answer is Option C.

Thanks,
Saquib
Quant Expert
e-GMAT

Register for our Free Session on Number Properties (held every 3rd week) to solve exciting 700+ Level Questions in a classroom environment under the real-time guidance of our Experts

Thank you for your explanation, e-GMAT expert.

Btw I have a general question, hope that you will help me clear this concern:
How can we know whether order of selection matters in a probability question? In other words, what are the indicators of order of selection?

In the above question, initially I didn't consider the order of 4 numbers chosen, so I worked out an answer different from all 5 choices. But then I realized the denominator is very big, I thought I might overlook many cases... the selecting order could be the key... so I calculated again and figured out the correct answer.

Since the above question is not an official one, I cannot draw any conclusion as to whether there is any OG/GMATPrep question in which no indicator is provided, and we have to test each case. I believe that such an experience expert as you could give me a reliable answer.

Non-Human User
Joined: 09 Sep 2013
Posts: 11430
Re: Four integers are randomly selected from the set {-1,0,1}, with  [#permalink]

### Show Tags

15 Oct 2018, 15:38
Hello from the GMAT Club BumpBot!

Thanks to another GMAT Club member, I have just discovered this valuable topic, yet it had no discussion for over a year. I am now bumping it up - doing my job. I think you may find it valuable (esp those replies with Kudos).

Want to see all other topics I dig out? Follow me (click follow button on profile). You will receive a summary of all topics I bump in your profile area as well as via email.
_________________
Re: Four integers are randomly selected from the set {-1,0,1}, with   [#permalink] 15 Oct 2018, 15:38
Display posts from previous: Sort by


# Math Help - Freaky series using limit comparison test!

1. ## Freaky series using limit comparison test!

How in the world do you determine the following series' convergence/divergence specifically using the limit comparison test?

from n=1 to n=infinity

ln (2n+1)/ (n^2 + 2n)

I'm bamboozled and befuddled!

2. Originally Posted by Kaitosan
How in the world do you determine the following series' convergence/divergence specifically using the limit comparison test?

from n=1 to n=infinity

ln (2n+1)/ (n^2 + 2n)
I would write the n'th term as $\frac{\ln(2n+1)}{n^2+2n} = \frac{\ln(2n+1)}{\sqrt n}\frac{\sqrt n}{n^2+2n}$. Then because "ln(n) goes to infinity slower than any positive power of n", it follows that the first fraction becomes small. The second fraction, $\frac{\sqrt n}{n^2+2n}$, is approximately $n^{-3/2}$. So do the limit comparison test, comparing the given series with the convergent series $\sum n^{-3/2}$.

3. Hm. I understand things better now. Thanks a lot.

4. Originally Posted by Opalg
I would write the n'th term as $\frac{\ln(2n+1)}{n^2+2n} = \frac{\ln(2n+1)}{\sqrt n}\frac{\sqrt n}{n^2+2n}$. Then because "ln(n) goes to infinity slower than any positive power of n", it follows that the first fraction becomes small. The second fraction, $\frac{\sqrt n}{n^2+2n}$, is approximately $n^{-3/2}$. So do the limit comparison test, comparing the given series with the convergent series $\sum n^{-3/2}$.
Also, what's to prevent me from using, say, "n" instead of sqrt(n)? In that way, it will appear that the series diverges....

I know it's against the rule to bump topics but I don't care, I really need help. I might as well post another topic.

Anyways, I followed Opalag's directions but, strangely, I got zero. According to the limit comparison test, if the number equals zero or infinity, then the result is inconclusive. Please clarify?

Also, why would I not use like n^2 instead of sqrt(n)? If I had done that then the series appears to diverge!

5. Originally Posted by Kaitosan
I know it's against the rule to bump topics but I don't care, I really need help. I might as well post another topic.

Anyways, I followed Opalg's directions but, strangely, I got zero. According to the limit comparison test, if the number equals zero or infinity, then the result is inconclusive. Please clarify?

Also, why would I not use like n^2 instead of sqrt(n)? If I had done that then the series appears to diverge!

Okay, what the limit comparison test says is that if $\textstyle\sum a_n$ and $\textstyle\sum b_n$ are series of positive terms, $\lim_{n\to\infty}\frac{a_n}{b_n}$ exists and $\textstyle\sum b_n$ converges, then $\textstyle\sum a_n$ converges. (The test is sometimes stated in the form that if the limit exists and is nonzero then $\textstyle\sum a_n$ converges if and only if $\textstyle\sum b_n$ converges, but that is not what is needed for this example.)

If $a_n = \frac{\ln(2n+1)}{n^2+2n}$, and you choose $b_n = 1/n^p$ for some p between and 2, then $\textstyle\sum b_n$ will converge (because p>1), and $\lim_{n\to\infty}\frac{a_n}{b_n}$ will be 0 (because p<2).

I hope that makes it clearer. (If you get an infraction for bumping, tell the Moderator that I think you were justified on this occasion.)

6. Or we can bound the general term: we have $\ln x< 2\sqrt{x}-2,\,\forall\,x>1,$ thus for $n\ge1$ it's $\frac{\ln (2n+1)}{n^{2}+2n}< \frac{2\sqrt{2n+1}-2}{n^{2}+2n}< \frac{4\sqrt{n}}{n^{2}}=\frac{4}{n^{3/2}},$ then your series converges since $\sum\limits_{n=1}^{\infty }{\frac{1}{n^{3/2}}}<\infty .$

7. Originally Posted by Opalg
Okay, what the limit comparison test says is that if $\textstyle\sum a_n$ and $\textstyle\sum b_n$ are series of positive terms, $\lim_{n\to\infty}\frac{a_n}{b_n}$ exists and $\textstyle\sum b_n$ converges, then $\textstyle\sum a_n$ converges. (The test is sometimes stated in the form that if the limit exists and is nonzero then $\textstyle\sum a_n$ converges if and only if $\textstyle\sum b_n$ converges, but that is not what is needed for this example.)

If $a_n = \frac{\ln(2n+1)}{n^2+2n}$, and you choose $b_n = 1/n^p$ for some p between and 2, then $\textstyle\sum b_n$ will converge (because p>1), and $\lim_{n\to\infty}\frac{a_n}{b_n}$ will be 0 (because p<2).

I hope that makes it clearer. (If you get an infraction for bumping, tell the Moderator that I think you were justified on this occasion.)

Why must p be between 1 and 2? You simplified the series so as to exclude the ln expression in order to dig up the right-handed series for the b series. In that process of simplification, you can input any number in the bottom left and and the top right, and each number brings a different convergence/divergence result!

Also, you seems to contradict yourself. If an/bn is nonzero and finite and if bn converges, then an converges. But you says an/bn converges to zero!

Let me repeat my understanding for the limit comparison test-

To evaluate the series an, pick bn based on an's highest ordered term in each numerator and denominator. Then structure an/bn and look for the limit. If the limit is between zero and infinity and if bn converges, then an/bn converges. But an/bn converges to zero! I'm so confused.

Please don't make me bump this topic again.

8. Originally Posted by Kaitosan
Why must p be between 1 and 2? You simplified the series so as to exclude the ln expression in order to dig up the right-handed series for the b series. In that process of simplification, you can input any number in the bottom left and and the top right, and each number brings a different convergence/divergence result!

Also, you seems to contradict yourself. If an/bn is nonzero and finite and if bn converges, then an converges. But you says an/bn converges to zero!
Please read what I said. I stated very carefully the form of comparison test that I was using. I said that if the ratio $a_n/b_n$ converges (to any limit, including the possibility that the limit might be zero) and if $\textstyle\sum b_n$ converges, then $\textstyle\sum a_n$ converges.

If you take $a_n = \frac{\ln(2n+1)}{n^2+2n}$ and $b_n = 1/n^{3/2}$, then $\frac{a_n}{b_n} = \frac{n^{3/2}\ln(2n+1)}{n^2+2n} = \frac{\ln(2n+1)}{n^{1/2} + 2n^{-1/2}} \to 0$ as $n\to\infty$. therefore, by the limit comparison test in the form that I stated, $\textstyle\sum a_n$ converges.

9. Originally Posted by Opalg
Please read what I said. I stated very carefully the form of comparison test that I was using. I said that if the ratio $a_n/b_n$ converges (to any limit, including the possibility that the limit might be zero) and if $\textstyle\sum b_n$ converges, then $\textstyle\sum a_n$ converges.
Looks like we found our "communication hitch." Based on what it looks like, there are two possibilities. First, my book is wrong. Or, secondly, you may be slightly off the definition of the limit comparison (I say this in humility, there's always a good chance that I'm wrong).

My book gives the definition of the limit comparison test in the following -

"Let an and bn be positive-termed series. Let L = lim (n to infinity) an/bn. If 0 < L < +infinity, then an and bn either both converge or both diverge. If L = 0 or L = +infinity, then the test is inconclusive."

The issue here is the domain of the limit comparison test and whether it includes zero. It's there, I copied exactly as my book puts it. What's going on?

I really appreciate the fact that you replied speedily!

10. Originally Posted by Kaitosan
My book gives the definition of the limit comparison test in the following -

"Let an and bn be positive-termed series. Let L = lim (n to infinity) an/bn. If 0 < L < +infinity, then an and bn either both converge or both diverge. If L = 0 or L = +infinity, then the test is inconclusive."

The issue here is the domain of the limit comparison test and whether it includes zero. It's there, I copied exactly as my book puts it. What's going on?
I can only quote what I said before:

Originally Posted by Opalg
Okay, what the limit comparison test says is that if $\textstyle\sum a_n$ and $\textstyle\sum b_n$ are series of positive terms, $\lim_{n\to\infty}\frac{a_n}{b_n}$ exists and $\textstyle\sum b_n$ converges, then $\textstyle\sum a_n$ converges. (The test is sometimes stated in the form that if the limit exists and is nonzero then $\color{red}\textstyle\sum a_n$ converges if and only if $\color{red}\textstyle\sum b_n$ converges, but that is not what is needed for this example.)
Your book uses the version in red, but the slightly different version that I was using is used by some other authors, and is more useful for dealing with the example in this thread.

In fact, I think that your book is somewhat misleading in claiming that the test is inconclusive when the limit is zero or infinity. As my version of the test shows, it is possible to draw conclusions in these cases. However, in those situations the test can only be used to get an implication in one direction; in these cases it is not an "if and only if" test.

11. Aaaah! I see! Thank you so much, I understand. I'll keep in mind that there are two "versions" of the limit comparison test then. Thanks for not giving me up.


# Between any two powers of $5$ there are either two or three powers of $2$

Is this statement true?

Between any two consecutive powers of $5$, there are either two or three powers of $2$.

I can see that this statement is true for cases like $$5^1 < 2^3 < 2^4 < 5^2$$ or $$5^3 < 2^7 < 2^8 < 2^9 < 5^4$$

But I am having a trouble figuring out the proof through generalization.

Could somebody help me?

How many integer multiples of $\log_5(2)$ can we fit between the integers $n$ and $n+1$? It's not too hard to see that since $\log_5(2)<0.5$, there are at least $2$ such numbers. But, since $3\log_5(2)>1$, there are at at most $3$ such numbers. *

So then, if $n$ and $n+1$ straddled $2$ multiples, we would have (for an appropriate integer, $k$): $$n<k\log_5(2)<(k+1)\log_5(2)<n+1\\\Rightarrow5^n<2^k<2^{k+1}<5^{n+1}$$ Conversely, if $3$ multiples were straddled, we would have $$n<k\log_5(2)<(k+1)\log_5(2)<(k+2)\log_5(2)<n+1\\\Rightarrow5^n<2^k<2^{k+1}<2^{k+2}<5^{n+1}$$

Therefore there are between $2$ and $3$ powers of $2$ between each successive powers of $5$.

* To visualise this, consider the figure below. The red points are multiples of $\log_5(2)$. The distance between the red points ($\approx0.43$) is small enough to guarantee that at least $2$ of them lie between the black points. However the gap between $4$ red points ($\approx1.29$) is too wide to fit between the black points. This is irrespective of where the red points begin.

Here's a fun graph to play around with https://www.desmos.com/calculator/qfqers5mmg. No matter where you start the sequence of red points (by varying the parameter $h$), you inevitably have either $2$ or $3$ red points between the black points.

Basically, it boils down to the fact that $5$ is between $2^2 = 4$ and $2^3 = 8$. Here's a proof, though.

Let $5^a$ and $5^{a+1}$ be the two consecutive powers of $5$. Let $2^b$ be the smallest power of $2$ that exceeds $5^a,$ and $2^c$ the largest below $5^{a+1}$.

Then we have $2^{b-1} \leq 5^a < 2^b$ and $2^c < 5^{a+1} \leq 2^{c+1}$.

From this we get $$\frac{2^{c}}{2^{b}} < \frac{5^{a+1}}{5^a} \leq \frac{2^{c+1}}{2^{b-1}}$$ or, equivalently, $$2^{c-b} < 5 \leq 4 \cdot 2^{c-b}.$$

This inequality can be rewritten as $\frac{5}{4} \leq 2^{c-b} < 5$, which proves that $c - b$ is either $1$ or $2$. Thus the powers of $2$ between $5^a$ and $5^{a+1}$ are either $2^b, 2^{b+1} = 2^c$, or $2^b, 2^{b+1}, 2^{b+2} = 2^c.$ This is what you wanted.

We can see mathematically that there is a ratio between the number of powers of $2$ and the number of powers of $5$ below a certain integer $a$.

Intuitively, the ratio would be $\log_25$, or $2.32$. On average, for every power of $5$, you get $2.32$ powers of $2$. That would translate to about $2$ or $3$ powers of $2$ between every two powers of $5$.

If this isn't completely intuitive, notice that there are exactly $3$ more powers of $2$ than $8$, as $\log_28 = 3$. For example, out of all integers below $100$, there are $6$ powers of $2$ ($2,4,8,16,32,64$) and $2$ powers of $8$ ($8,64$).

We can extend to this to any integers $x$ and $y$, provided they are not $0$ or $1$: For all integers below an integer $z$, the ratio of the number of exponents of $a$ to the number of exponents of $b$ is $\log_ab$.

In the special case $[1,5]$, we see that 1, 2 and 4 are in the interval but 8 and up are not. There are powers of 2 less than and powers of two greater than any other power of 5.

There can't be more than three, because if $0 < a \leq b < 2b < 4b < 8b \leq 5a$, we get the contradiction $8a \leq 5a$ for a positive number $a$.

Nor can there be zero, because if $0 < b < a < 5a < 4b$, we get the contradiction $5b < 4b$ for a positive number b.

Nor can there be one, because the argument still holds if we insert the condition $a \leq 2b \leq 5a$.

You already found existence proofs for two or three intermediate powers.

The explanations in the other answers are great, but that's a very elementary proof.

• Hi, @Davislor. Sorry but I don't quite follow where $8a\leq 5a$ comes from - it seems as though you've replaced the $b$ that was previously in the inequality but how is this justified? – Jam Jul 26 '18 at 20:09
• @Jam $0< a \leq b$, so $8a \leq 8b$. Bit, we assumed $8b \leq 5a$. Thus the contradiction that $8a \leq 5a$ for positive $a$. – Davislor Jul 26 '18 at 20:15
• @Jam: Do you find my elementary proof any clearer? – Ilmari Karonen Jul 27 '18 at 10:33
• @IlmariKaronen I find both quite clear, thanks - I was just stuck on one step in Davislor's :) – Jam Jul 27 '18 at 11:04

It's easy enough to see that this is indeed true, even without using logarithms.

Let $a$ be some power of $5$, and let $b$ be the least power of $2$ not less than $a$. Then the next power of $5$ after $a$ is obviously $5a$, while the next three powers of $2$ after $b$ are $2b$, $4b$ and $8b$.

Since, by definition, $a \le b$, it follows that $5a \le 5b < 8b$. Thus, there can be at most three powers of $2$ ($b$, $2b$ and $4b$) between $a$ and $5a$.

Conversely, since $b$ is the least power of $2$ not less than $a$, it follows that $\frac12 b < a$. Thus, equivalently, $2b < 4a < 5a$, so there must be at least two powers of $2$ ($b$ and $2b$) between $a$ and $5a$.

BTW, if you look closely at the proof above, you may note that it doesn't actually use the assumption that $a$ is a power of $5$ anywhere. Thus, in fact, we've proven a more general result: for any positive number $a$, there are either two or three powers of $2$ between $a$ and $5a$.

(In fact, the proof doesn't really use the assumption that $b$ is a power of $2$, either, so we could generalize the result even further in this direction if we wanted!)

Also, you may notice that the key observation behind the result above is that the number $5$ lies strictly between $2^2 = 4$ and $2^3$ = 8. Thus, by essentially the same logic as above, we can prove a similar result for other bases:

Between any two consecutive powers of $x$ there are at least $k$ and at most $k+1$ powers of $y$, where $x$ and $y$ are any numbers greater than $1$, and $k$ is the largest integer such that $y^k \le x$.

We know that

if $y-x >1$, for $x\geq 0, y>0$, then there $\exists n \in \mathbb{N}, n>0$ s.t. $$x<n<y \tag{1}$$

e.g. $n=\left \lfloor x \right \rfloor+1$, because $$x = \left \lfloor x \right \rfloor+\{x\}<\left \lfloor x \right \rfloor+1<x+1<y$$ In this case $$(k+1)\frac{\ln{5}}{\ln{2}}-k\frac{\ln{5}}{\ln{2}}=\frac{\ln{5}}{\ln{2}}>1$$ and from $(1)$, there $\exists n\in\mathbb{N}$ s.t. $$k\frac{\ln{5}}{\ln{2}}<n<(k+1)\frac{\ln{5}}{\ln{2}} \iff\\ k\ln{5}<n\ln{2}<(k+1)\ln{5} \iff \\ 5^k < 2^n<5^{k+1}$$ However $\frac{\ln{5}}{\ln{2}}\approx 2.32>2$ and $(1)$ can be extended to

if $y-x >2$, for $x\geq 0, y>0$, then there $\exists n \in \mathbb{N},n>0$ s.t. $$x<n<n+1<y \tag{2}$$


## Tuesday, April 17, 2007

### Properties of Matrix Multiplication

Multiplication can only occur between matrices A and B if the number of columns in A match the number of rows in B. This presents the very important idea that while multiplication of A with B might be a perfectly good operation; this does not guarantee that multiplication of B with A is a perfectly good operation.

Even if matrix A can be multiplied with matrix B and matrix B can be multiplied to matrix A, this doesn't necessarily give us that AB=BA. In other words, unlike the integers, matrices are noncommutative.

Property 1: Associative Property of Multiplication

A(BC) = (AB)C

where A,B, and C are matrices of scalar values.

Proof:

(1) Let D = AB, G = BC
(2) Let F = (AB)C = DC
(3) Let H = A(BC) = AG
(4) Using Definition 1, here, we have for each D,F,G,H:

di,j = ∑k ai,k*bk,j

gi,j = ∑k bi,k*ck,j

fi,j = ∑k di,k*ck,j

(5) So, expanding fi,j gives us:

fi,j = ∑k (∑l ai,l*bl,j)ck,j =

(∑kl) ai,l*bl,k*ck,j =

= ∑l ai,l*(∑k bl,k*ck,j) =

= ∑l ai,l*gl,j = hi,j

QED

Property 2: Distributive Property of Multiplication

A(B + C) = AB + AC
(A + B)C = AC + BC

where A,B,C are matrices of scalar values.

Proof:

(1) Let D = AB such that for each:

di,j = ∑k ai,k*bk,j

(2) Let E = AC such that for each:

ei,j = ∑k ai,k*ck,j

(3) Let F = D + E = AB + AC such that for each:

fi,j = ∑k ai,k*bk,j+ai,k*ck,j = ∑k ai,k[bk,j + ck,j]

(4) Let G = B+C such that for each:

gi,j = bi,j + ci,j

(5) Let H = A(B+C) = AG such that for each:

hi,j = ∑k ai,k*gk,j

(6) Then we have AB + AC = A(B+C) since for each:

hi,j = ∑k ai,k[bk,j + ck,j]

(7) Let M = A + B such that for each:

mi,j = ai,j + bi,j

(8) Let N = (A+B)C = MC such that:

ni,j = ∑k mi,k*ck,j =

= ∑k (ai,k + bi,k)*ck,j

(9) Let O = BC such that:

oi,j = ∑k bi,k*ck,j

(10) Let P = AC + BC = E + O such that:

pi,j = ei,j + oi,j =

= ∑k ai,k*ck,j + ∑k bi,k*ck,j =

= ∑k [ai,k*ck,j + bi,k*ck,j] =

= ∑k (ai,k + bi,k)*ck,j

QED

Property 3: Scalar Multiplication

c(AB) = (cA)B = A(cB)

Proof:

(1) Let D = AB such that:

di,j = ∑k ai,k*bk,j

(2) Let E = c(AB) = cD such that for each:

ei,j = c*di,j = c*∑k ai,k*bk,j

(3) Let F = (cA)B such that:

fi,j = ∑k (c*ai,k)*bk,j = c*∑k ai,k*bk,j

(4) Let G = A(cB) such that:

gi,j = ∑k ai,k*(c*bk,j) =

= c*∑k ai,k*bk,j

QED

Property 4: Muliplication of Matrices is not Commutative

AB does not have to = BA

Proof:

(1) Let A =

(2) Let B =

(3) AB =

(4) BA =

QED

References
• Hans Schneider, George Philip Barker, , 1989.

Eva Acosta said...

Hi,
I am a math teacher.
You can revise your understanding of matrices solving exercises about addition, subtraction and multiplication of matrices. Inverse,... at www.emathematics.net
Fantastic!!!

Anonymous said...

hi
i am a student taking a course in linear algebra. i just wanted to say that your tutorrial is very helpfull. so post some more on this topic.
thank you

Luis said...

Amittai Aviram said...

Hi! Thank you very much for providing this resource! I am troubled, however, by something in your proof of the associativity of matrix multiplication. (Since blogger.com will not let me use the necessary HTML tags, I will attempt to use LaTeX-like notation instead.)

In (4), you have
d_{i,j} = \sum_{k} a_{i,k}*b_{k,j}
f_{i,k} = \sum_{k} d_{i,k}*c_{k,j}
Then, in (5), you expand this last equation as
f_{i,j} = \sum_{k} (\sum_{l} a_{i,l}*b_{l,j}) c_{k,j}
However, we are expanding d_{i,k} from the previous equation, not d_{i,j} (where the outer summation symbol binds the variable k). And
d_{i,k} = \sum_{l} a_{i,l}*b_{l,k}
The summation symbol that binds k becomes the outer summation symbol in the expansion. So the correct expansion of the whole equation should be:
f_{i,j} = \sum_{k} (\sum_{l} a_{i,l}*b_{l,k}) c_{k,j}
which does not lend itself to so neat a proof as the one you present. A correct proof, though with rather messier notation, can be found here:
http://linear.ups.edu/xml/0094/fcla-xml-0.94li30.xml

Amittai Aviram said...

Another page that has a correct proof (avoiding the error noted above) can be found here:
http://www.proofwiki.org/wiki/Matrix_Multiplication_is_Associative#Proof

Larry Freeman said...

Hi Amittai,

Thanks very much for pointing out the mistake. I will revise the proof and post a comment on this blog when it is fixed.