Recreational Math I: 4×4 squares: Some sequences work better than others

Hits: 14

I was experimenting with Danny Dawson’s 4×4 magic square script, and began to consider writing my own script. But I just thought I would do a few runs for my own research. I wanted to thank Mr. Dawson for his fine work which I am obviously gaining knowledge from, but his comments page thought I was a spam bot, and rejected my comments. Oh well ….

The central topic of discussion here centers on building an algorithm for a computer program that can search for and find all or most squares, centering on initial construction. But the discussion on pairings work for magic squares generally.

Some number pairings work better on the 4×4 square than others. What I mean by number pairings are two sequential numbers being placed next to each other along a column or row of the magic square. Dawson’s script allows me to place any numbers on the magic square, and it would output all of the magic squares that fit the arrangement of numbers I suggested by filling in the rest. I only worked with two numbers, and it would suggest to me complete squares which work with that placement of a pair of numbers. Some number pairs resulted in more than one magic square, while other pairs gave no squares.

It would tell me that in a computer algorithm for such squares, if an “unsuccessful” pair of numbers show up next to each other in a magic square made by a brute force algorithm such as Dawson’s, the smart thing to do is to detect this situation and abandon the square’s construction, thus saving computer procesing time, an amount of time Dawson attested to as being potentially long, on the order of hours at best, to decades at worst.

My research was far from thorough, but I think I took into account most situations where the pairings would show up, barring left-right reflections, rotations, or up-down reflections of the same square.  It is possible I may have missed some, due to clues that seemed to be left behind by some of the successful combinations. And I only considered pairings of sequential numbers, not just any pairings of numbers, of which there are (16 × 15)/2 = 120 combinations.

First, the combinations of sequential numbers that were NOT successful: “3  4”, “7  8”, “9  10”, “11  12” and “13  14”. Finding these pairs next to each other resulted in nothing output in all of the ways they might show up that I’ve tried. This is likely not the true situation, since when I tried “5  6”, only one unique square was found (and no others); while an attempt to try the famous Durer pun “1514” on two adjacent squares resulted in nothing until I moved the “15  14” to the centre columns of the top row. No other unique solutions were found for the Durer pun. None at all.

If a programmer were serious to find such “rare” solutions, then he or she would not consider ignoring these sequential pairs. On the other hand, if missing a half dozen or so squares is not important, then one is wise to look for these sequences in a row or column and abandon all such squares to save time, rather than making a square that is destined to fail.

In fact, it would be worth considering to check for these pairings before checking for “magic”, although both the pairings and magic can be done on-the-fly, during construction as a way of bailing out early and moving on.

All other successful pairings:

  • 1 2, and 2 3 both gave generous numbers of squares
  • 4 5: gave patterns reminiscent of the Durer square
  • 5 6: only 1 square was found in my trials
  • 6 7, 8 9, 10 11, 12 13: all gave generous numbers of squares
  • 14 15: only worked if these numbers appeared in the middle columns of the top row (means that the bottom row and both left and right sides should work also; in addition, the “15 14” combination should work in the same way) (11 solutions)
  • 15 16: Gave a few solutions, but only in the first and second cells of the first row, as far as I can tell.

Obviously, the five “failed” pairings given above are not the whole picture. Of the 120 possible pairs of numbers between 1 and 16 that can exist, there are obviously more pairs that would result in no square being formed, thus saving more time.

Sunshine List 2021

Hits: 15

The Ontario government has released The Sunshine List. It is a publically-avaialable list which lists the names, positions, and locations of any government employee earning over $100K per year, and was started in 1995 by the Mike Harris government as a way of naming and shaming those who commit the sin of earning above six figures. The article that appeared in today’s Toronto Star had a picture of an elementary school teacher and a classroom of young children, just below the headline, to suggest the targets of this list.

However, the list targets all 240,000 or so full-time government employees who get a paycheck from Queens Park, regardless of the sector of government invloved, such as Public Works, Healthcare, the ministries, OPG and the LCBO. And that just scratches the surface.

The 26 top wage earners working for school boards are those earning more than $250K. All of these people are school board directors, and the occasional associate director. When compared against the other sectors of government, the education sector is still the lowest-paid as they always have been. So it is no surprise that the sector called “School Boards”, according to the Sunshine List, are have the lowest average salary, for those earning above 100K.

The reality of such perceived largesse is twfold: the list which started in 1996 has become less impressive in its impact than it had been back then. $100K today has the same buying power as a salary of $69,769.70 back in 1996.

There is also taxation, which eats up $35,000 of your $100K gross earnings. The money you earn is not what you take home. And in 1996 dollars, the take-home pay of $65K can buy you what $45K used to back then. You can still live more or less comfortably and relatively debt-free on that salary, but it is far from lavish, especially if you live in the Greater Toronto Area because you won’t be able to afford a house or even a condo. An earner taking in $70,000 back in 1996 could buy a home in the GTA. Nowadays, an employee in the GTA earning $100,000 is lucky if they can find a two bedroom apartment that doesn’t break their bank account, especially if they are raising families.

Because of this, the magic number of $100,000 is outdated and much less meaningful than it used to be. It was a lot of money in 1996, but nowadays is barely above a living salary for a family of 4. It only looks big because of all the zeroes after the 1. To match the buying power of $100,000 in 1995, you would need to earn about $160,000 today.

The other aspect of this, is that the 85% of earners on the Sunshine List are earning between $100,000 and $110,000. 70% of earners on the Sunshine List are earning less than $105,000. That means that the per centage of earners just between $105K and $110K is barely 15% of the distribution. And as you go up in salary, the number of earners in each successive bracket falls like a rock. Also, keep in mind that the list isn’t giving you who is earning what, below $100,000. But because it takes a school teacher 10 years to get to that level, it is a safe bet that most Ontario government employees earn well below $100K, even in today’s dollars.

If we use $160,000 as the new cutoff (based on the same 1996 standard, adjusted for inflation), there are exactly 765 earners in Ontario working for school boards earning that either 160K or more, none of whom are teachers. That level of salary is generally earned by school board superintendents and the occasional principal. The 765 education sector earners is far fewer than the 80,434 sunshine earners working for school boards. There are many calls to update this list to take into account the change in standard of living of Sunshine earners, but as you can see number less than 1%, the list would not have nearly the same impact, nor cause anywhere near the same outcry.

And I have to say, why the outcry? We live in a world where Amazon workers are fired for being in the bathroom too long, thereby being a drain on Bezos’s ambition to buy himself another rocket. We live in a world where the average CEO earns more than 300 times more than the average worker under him. Government workers got where they were because of union activity, and out of the recognition that the boss wasn’t going to be nice one day and give us a living wage. The ones who don’t form unions get the shit jobs and shitty lives they duly fought for.

I realize I am being sardonic, but I am also suggesting that fighting for a living wage and adequate benefits is not easy, and is always a struggle, and bosses are hired to care more about profits than whether your skill set matches what earnings you deserve, whether you are taking home a living wage, or even your mental or physical health. Where is the outrage at the CEOs of private companies who earn so much off the backs of their employees? Or even at private companies who form government “partnerships” which benefit off the largesse of the taxpayers? These latter people are invisible on the Sunshine List.

People lose their minds when a government employee earns a living wage, but don’t seem to have a problem when a CEO reports a salary at a shareholders’ meeting in the billions of dollars, don’t know what to do with all that money, and buy themselves a rocket. Meanwhile their employees are so stressed they are unable to hold down a warehouse job for longer than a year or so, lest they be sacked for the crime of taking a bathroom break in an actual bathroom rather than peeing in a bottle like a good employee. This is what happens when you don’t fight for better working conditions.

To the left is a summary of salaries above 100K paid to all employees in the School Board sector of government. This encompasses all managers, custodial staff, secretaries, teachers, psychologists, other specialists, and board office employees right up to the director. Nearly everyone earns below 110K, with the number of earners in each successive bracket falling precipitously as you go up in salary level. With the full list sorted in order of salary, it is possible to determine the median salary for a School Board Sunshine List employee (remember, not all government employees) as being $103,129.16 or, in 1996 dollars, $65,411.73, using data provided by the Toronto Star to do the conversion.

Below is a breakdown by government sector.

Prime Curios IV: The number 13

Hits: 31

12 is a nice number. It is why we order a dozen doughnuts, for example. You can most likely keep all the guests happy, allowing you to divide the doughnuts among 2, 3, 4, 6, or 12 guests (not counting yourself). Thus, 12 has a lot of divisors, making it a highly composite number. It would have been nice to have our money denominated under a base-12 system (called a “dozenal” system), since there are so many ways to evenly divide the cash.

13 is just one more added to 12, but then the number becomes very uncooperative by contrast. You can’t even divide 13 in half, evenly. While 13 doughnuts is a called “a baker’s dozen”, there is no way to divide them among guests unless you have 12 guests; but at least this way you have a doughnut left over for yourself. It is amazing what happens sometimes when you add 1. But the indivisibility of 13 is a property shared by all prime numbers.

13 objects.

13 is the second number in a series called a star number. A star number is the number of objects you can arrange into a six-pointed star. The next 3 numbers in this series are: 37, 73, and 121. The first number was 1. 13 is likely the only positive number that is prime, lucky, happy, unlucky (depending on the culture), and Fibonacci.

An 18th-century American flag.

13 is the number of archimedian solids; the number of tricks in a bridge hand; the number of leaves on the olive branch of an American dollar bill; the number of both stars and stripes on an American flag from the 18th century; it is the greatest number of seconds that a chicken has been recorded flying; it is also the number of volumes in Euclid’s Elements; the number of record albums recorded by The Beatles; the number of digits in an ISBN number; and the number of rounds in Yahtzee.

13 in base-10 is 31 in base-(1+3) (or base-4). 13 is a factor of the 3-digit number abc if 13 is also a factor of a + 4b + 3c. 13 with its digits reversed is 31, which is also prime (called an emirp). ELEVEN PLUS TWO contains 13 letters; so does TWELVE PLUS ONE. Also, the product of pi, Euler’s constant, and the golden ratio, rounded down, or: \lfloor \pi e \Phi \rfloor = 13. Performing arithmetic on the first 5 primes yields 13 if done in the following manner: (5\times 11) - (2\times 3\times 7)=13.

The Republican logo

13 is the smallest Republican prime number. These are numbers whose left-hand digits (not counting the middle) are prime and the right-hand digits are not. 1 is not actually a prime number, nor is it composite. Democratic primes exist whose numeric patterns are the opposite. Thus, the reversal of 13, or 31, is a Democratic prime.


The number 1000000000000066600000000000001, which has the number of the Beast (666), flanked on both sides by 13 zeroes and beginning and ending with 1, is prime, and is called a Belphegor prime. This prime is also palindromic (reads the same backwards and forwards). Belphegor is one of the seven princes of hell, presiding over the deadly sin of sloth. The Belphegor prime is also a “naughty” prime, due to the number of naughts, or zeroes present in the number. This number also has 31 digits, which is 13, reversed.  There are 13 prime numbers between 13 and 31.

In 2013, there were two Friday the 13ths, and both were 13 weeks apart. 13 is the number of days the Julian calendar is behind the Gregorian calendar. ROT-13 is a kind of message encryption which “rotates” all letters in the message around the 13th letter of the alphabet with the effect of preventing accidental reading of internet text messages such as spoilers to novels or movies.

I researched the Prime Curios website; Numberphile on YouTube; and the OEIS library of number sequences for this article.

Prime Curios II (the number 17)

Hits: 16

The prime curios website has given me more to discuss so that I think I will choose some other numbers. In the first post in this series, I chose high, 12 to 15-digit prime numbers to discuss, and it wasn’t hard to find discussable numbers. Nearly anything I clicked on had something interesting about it.

Now I am going back to 2-digit numbers. The first one I chose is 17. Apparently, there are 17 ways to write the number 17 as the sum of primes. You are encouraged to try this out yourself before revealing what is underneath the “spoiler” below:

Click on this spoiler to see the 17 ways...

We have at our disposal 2, 3, 5, 7, 11, 13, and 17 to work with, so let’s see how we can do this (the last few took awhile):

        1. 17=17 (take care of the obvious)
        2. 17=13+2+2
        3. 17=11+3+3
        4. 17=11+2+2+2
        5. 17=7+7+3
        6. 17=7+5+5
        7. 17=7+5+3+2, the sum of the first 4 consecutive primes.
        8. 17=7+3+3+2+2
        9. 17=7+2+2+2+2+2
        10. 17=5+3+3+3+3
        11. 17=5+5+5+2
        12. 17=5+5+3+2+2
        13. 17=5+3+3+2+2+2
        14. 17=5+2+2+2+2+2+2
        15. 17=3+3+3+3+3+2
        16. 17=3+3+3+2+2+2+2
        17. 17=3+2+2+2+2+2+2+2


Some factoids about the number 17: Did’ja know …

      • 17 is the only number, when cubed, its digits equal the number: 17^3 = 4913 \Rightarrow 4+9+1+3=17
      • 17 = 24 + 1, which makes it almost a Mersenne prime. Mersenne primes are primes of the form 2n – 1.
      • 172 = 289 can be expressed as the sum of 1, 2, 3, 4, 5, 6, 7, 8 distinct squares.
        • There is one square, 172 itself
        • Sums of 289 in two distinct squares
          • 172 = 152 + 82
          • 172 = 122 + 122 + 12
        • Examples of obtaining 289 in 3 distinct squares:
          • 172 = 162 + 52 + 22 + 22
          • 172 = 122 + 82 + 92
          • There are several more with 3 distinct squares, when you get to 4 or more terms.
        • Obtaining 289 from 4 distinct squares, each appearing once:
          • 22 + 42 + 102 + 132
          • 22 + 52 + 82 + 142
          • 22 + 82 + 102 + 112
          • 32 + 62 + 102 + 122
        • Of course there are more, and click on the spoiler below at the bottom of this article to get a full list of the ways ot obtain a sum of 289 under these conditions, after trying at least a few yourself.
      • 172 = 34 – 43
      • 2(17+17) has “1717” as the first four digits. (17,179,869,184)
      • According to MIT hacker’s lore, 17 is referred to as the “least random” number.

The last point is special. Why is 17 considered “least random”? We have to not consider computers or shuffling of cards or mixing tickets in a hat, here. This is a purely human phenomenon. If a thousand people were asked to “radomly” speak out a number between 1 and 20, one would expect that each of the 20 numbers would be equally likely to be spoken out. This is far from the case. Instead, one would find that 17 is spoken out disproportionately more often compared with the other 19 numbers. If people were asked to “randomly” choose a number, a surprising number of them are primes, and 17 is the prime chosen most often. This is why it is said that 17 is the least random number to choose. The reason we choose prime numbers most often has less to do with our affinity for prime numbers and more to do with the fact that we seem to conflate “strange” or “unique” with “random”.

Click here to see 15 ways to get 289 with up to 8 unique perfect square terms.

The reading of this table is, taking the first line:

1, 2, 3, 4, 5, 7, 8, 11 =>
289 = 12 + 22 + 32 + 42 + 52 + 72 + 82 + 112

1, 2, 3, 4, 5, 7, 8, 11
1, 2, 3, 5, 9, 13
1, 3, 4, 5, 6, 9, 11
1, 3, 5, 6, 7, 13
2, 3, 4, 8, 14
2, 3, 5, 7, 9, 11
2, 4, 5, 6, 8, 12
2, 4, 5, 10, 12
2, 4, 6, 8, 13
2, 4, 10, 13
2, 5, 8, 14
2, 8, 10, 11
3, 6, 10, 12
8, 9, 12
8, 15


The Prime Curios Website

Hits: 36

I am currently sidetracked to the Prime Curios website. It deals with primes, their properties, and some rather fascinating patterns in the numbers. It is basically a catalogue of the more interesting primes and the curious properties of individual primes.

Well, I decided to kick its tires, and see what patterns it could see in numbers that I clicked on. I chose their category of 12 to 15-digit prime numbers, since I thought they are probably going to come up with boring information. This proved wrong very early on. Each number had a link, and led to a page with a paragraph or two of information on it. I noticed that most, but not all numbers in the list were prime. But first some primes I clicked on:

100,123,456,789: Well, I clicked on the second number in the list before I noticed that the number contains all the digits from 0 to 9 in sequence, with 10 at the beginning. This is a pandigital prime number. In fact, it is difficult to dispute the site’s first assertion that it is the smallest prime to contain the string “0123456789”. But it is also the smallest prime where if you wedged a zero in between each digit, it would still be prime: 10000010203040506070809. This last number has a prime number of digits and a prime number of zeros.

100,529,784,361: also contains the numbers 0 to 9, with 10 at the start, but this time not in order. But when you break them into groups, you get perfect squares: 100=10^2; 529=23^2; 784=28^2; and 361=19^2. Squaring each digit and concatenating the results gets us the string 100254814964169361, which is also prime.

101,111,111,111: I learned a new word today: emirp. An emirp is a prime spelled backwards. The definition is that the reversal of these digits yields a different prime. This is different from a number like “101”, which is a palidromic prime, since you get the same prime when writing the digits in reverse. Also the first two digits are “10” with 1’s repeated that many times.

1,919,110,119,191: This is a palindromic prime. You get the same number if you reversse the digits. Also the first six numbers: 191911 and the last six, 119191 are both prime and “emirp”. There is another oddity about 191911 and 119191: if you rotate the first of these numbers so that it appears upside down, you get 116161 (a prime); and the second one rotated, becomes 161611 (another prime, and emirp compared with 116161). Primes generated by such a rotation is called an invertible prime. It can only happen if a digit can be a recognizable digit when turned upside-down. Such primes must therefore only contain the digits: 0, 1, 6, 8 , or 9. 1,616,110,116,161, the rotation of the entire original number, is also prime.

6,886,699,889: This is a prime which is  the same prime when rotated upside down. These invertible primes are referred to as Strobogrammatic primes.

28,116,440,335,967: This is the smallest multidigit prime number that is also a narcissistic number: the sum of each digit raised to the power of the number of digits, equals the number: 2^{14}+8^{14}+1^{14}+1^{14}+6^{14}+4^{14}+4^{14}+0^{14}+3^{14}+3^{14}+5^{14}+9^{14}+6^{14}+7^{14}  = 28,116,440,335,967.

Okay, fine. But what about the composite numbers listed by Prime Curios? Again, sticking to the same range of digits …

157,639,024,808: This composite number uses up all of the digits from 0 to 9 at least once. This makes the number pandigital, like others we’ve seen. It is also a perfect cube: 157,639,024,808 = 5402^3. In addition, the number written backwards is prime.

2,504,730,781,961: This composite pandigital number is also the 61st Fibonacci number. 61 is prime, and are the last two digits of the number.

265,744,701,192,502: Someone with time on their hands figured out that if you multiply this number by 11 and add 1, you get a number which is a concatenation of the primes 2 to 29: 2,923,191,713,117,523, which can be read as the primes: 29, 23, 19, 17, 11, 7, 5, 2, and 3. They appear in reverse order of the primes except for the 3. However, this number is also composite.

For the sake of trivia, the largest known prime, according to this site, is: 282,589,933 – 1, a Mersenne prime containing 24,862,048 digits found in 2018 by Patrick Laroche of Ocala, Florida, running a GIMPS program on their computer.

The delusion of counting to a billion

Hits: 28

In math or science class, it was sometimes helpful to give my students some idea of the size of numbers. One of those numbers was 1 billion. We worked it out that if you counted one number per second from 1 to 1 billion, it would take you around 32 years to get there. If you subtract 8 hours a day for both eating and sleeping, it would take around 42.7 years. It turns out that this length of time is wildly optimistic. In reality, accounting for the same daily breaks, it takes way longer. How much longer?

Jeremy Harper

Back in September 2007, software developer and Alabama native Jeremy Harper held the Guiness World Record for counting up to 1 million (highest number on record, spoken out loud). It took him 89 days, accounting for 8 hours of sleeping and eating per day. At 1 number per second, it should have taken him 15.4 days with the same breaks. It could be that, going by his videos left online, that he was deliberately slow in counting. He would give himeself a second or so in between each number, and not rush the number he was speaking. It would also be better to say the number in one breath, so that 1 second breaks between numbers allowed for a good inhale. I think there was a recognition that he not waste his energy on speed, otherwise he might not make it.

Guiness would usually send observers for such world records, but he had the entire 89 days of counting, eating, and sleeping documented on a YouTube livestream, making it easier for his feat to be proven. I have seen this stated elsewhere as the “fastest” count to 1 million, but I suspect that it is because it is the “only” count to 1 million. But accounting for breath control, it is likely the fastest one can expect.

Getting back to our count to 1 billion, which is 1000 million. It would have taken Jeremy, if he had the time, 89,000 days to count to 1 billion accounting for meal/sleep breaks and breath control. That would be around 243.7 years. Not possible. But even if Jeremy were to double his efforts, by counting every number in half the time, it would still take around 121.8 years to count that high. This is about as optimistic as one can be with 1 billion. But as you can see, this is triple our original estimation of 42.7 years, based on our naive assumption of 1 number per second. We are not taking into account that with more digits, numbers beyond 1 million will take longer to speak out than numbers below 1 million. The fact that there are 999 million numbers above 1 million and below or equal to 1 billion would likely skew closer to 243.7 years than to 121.8 years, even if we sped up the counting in the manner just described. Again, this is all pie-in-the-sky, since neither of these targets are humanly possible, and are hopelessly beyond the “naive” target of 42.7 years.

But to proceed ad absurdum, we have read about numbers in the trillions, such as the American military budget or their American infrastructure package. A trillion is a thousand billion, or a million million; literally \left(10^6\right)^2=10^{12}. The British used to call a trillion a “billion”, in the sense of a “bi-million” or a million million. But that got confused with the North American use of “billion”, so the British adopted the American parlance of a billion, and have been using it for trade since 1975. So, a thousand million is a billion, and a million million is a trillion, pretty much worldwide.

A trillion is “this” big.

The 89 million days (or more) it would take to count to 1 trillion would take us past the next few ice ages, should humanity last that long. It is the equivalent of 243,669 years, rounded to the nearest year. If these were light years, this would be more than the diameter of the Milky Way galaxy. And speaking of the Milky Way, there are  on the order of 1 trillion stars in our galaxy. There are also on the order of 1 trillion galaxies of every conceivable size in the known universe. Indeed, one trillion is a truly astronomical number.

Inverse of a larger matrix and Power Series

Hits: 28

Most textbooks I have on Lin Alg discuss finding the inverse of a 2×2 matrix,and appear to have little to say about inverting 3×3 matrices and above. I was trying to invert a 5×5 matrix, but all I could find after looking through two linear algebra textbooks, and the internet was info for 2×2 matrices.

    \begin{equation*} \begin{bmatrix}a & b\\c & d\end{bmatrix}^{-1} = \frac{1}{ad-bc} \begin{bmatrix}d & -b\\-c & a\end{bmatrix} \end{equation*}

… except the web page I read used comic sans. Then there was this really good lin alg textbook I came across that had a technique that used a 3×3 example that could scale to any size. Bingo. The next problem will be presenting this to you as there appears to be no way (after an online lookup) to present the notation to you in a satisfying way. I will separate two matrices with a right arrow (\longrightarrow) instead of using a double matrix with a vertical bar in the middle. I also have to reckon with limitations in using Latex notation in a blog article. So, please excuse any makeshift notation used in this article.

    \begin{equation*} \begin{bmatrix} 1&0&0&0&0 \\ 1&1&0&0&0 \\ 1&2&1&0&0 \\ 1&3&3&1&0 \\ 1&4&6&4&1 \\ \end{bmatrix}\longrightarrow \begin{bmatrix} 1&0&0&0&0 \\ 0&1&0&0&0 \\ 0&0&1&0&0 \\ 0&0&0&1&0 \\ 0&0&0&0&1 \\ \end{bmatrix} \end{equation*}

The idea being, to turn the left matrix into the right matrix, applying the techniques of Gauss-Jordan elimination. Meanwhile, any operation I commit to the left matrix must be also done to the right matrix. It turns out that you don’t necessarily get the same matrix. First, I subtract the first row from the rows below:

    \begin{equation*} \begin{bmatrix} 1&0&0&0&0 \\ 0&1&0&0&0 \\ 0&2&1&0&0 \\ 0&3&3&1&0 \\ 0&4&6&4&1 \end{bmatrix}\longrightarrow \begin{bmatrix} 1&0&0&0&0 \\ -1&1&0&0&0 \\ -1&0&1&0&0 \\ -1&0&0&1&0 \\ -1&0&0&0&1 \\ \end{bmatrix} \end{equation*}

Then, I apply the same thinking with the second row to eliminate variables in the second column of the left matrix, and proceed similarly for subsequent columns of the left-hand matrix:

    \begin{equation*} \begin{bmatrix} 1&0&0&0&0 \\ 0&1&0&0&0 \\ 0&0&1&0&0 \\ 0&0&3&1&0 \\ 0&0&6&4&1 \\ \end{bmatrix} \longrightarrow \begin{bmatrix} 1&0&0&0&0 \\ -1&1&0&0&0 \\ 1&-2&1&0&0 \\ 2&-3&0&1&0 \\ 3&-4&0&0&1 \\ \end{bmatrix} \end{equation*}

    \begin{equation*} \begin{bmatrix} 1&0&0&0&0 \\ 0&1&0&0&0 \\ 0&0&1&0&0 \\ 0&0&0&1&0 \\ 0&0&0&4&1 \\ \end{bmatrix}\longrightarrow \begin{bmatrix} 1&0&0&0&0 \\ -1&1&0&0&0 \\ 1&-2&1&0&0 \\ -1&3&-3&1&0 \\ -3&8&-6&0&1 \\ \end{bmatrix} \end{equation*}

    \begin{equation*} \begin{bmatrix} 1&0&0&0&0 \\ 0&1&0&0&0 \\ 0&0&1&0&0 \\ 0&0&0&1&0 \\ 0&0&0&0&1 \\ \end{bmatrix}\longrightarrow \begin{bmatrix} 1&0&0&0&0 \\ -1&1&0&0&0 \\ 1&-2&1&0&0 \\ -1&3&-3&1&0 \\ 1&-4&6&-4&1 \\ \end{bmatrix} \end{equation*}


    \begin{equation*} \begin{bmatrix} 1&0&0&0&0 \\ 1&1&0&0&0 \\ 1&2&1&0&0 \\ 1&3&3&1&0 \\ 1&4&6&4&1 \\ \end{bmatrix}^{-1} = \begin{bmatrix} 1&0&0&0&0 \\ -1&1&0&0&0 \\ 1&-2&1&0&0 \\ -1&3&-3&1&0 \\ 1&-4&6&-4&1 \\ \end{bmatrix} \end{equation*}

You might recognize number pattern in the very first matrix to resemble part of Pascal’s Triangle:

    \begin{equation*} \begin{bmatrix} 1& 0& 0& 0& 0 \\ 1& 1& 0& 0& 0 \\ 1& 2& 1& 0& 0 \\ 1& 3& 3& 1& 0 \\ 1& 4& 6& 4& 1 \\ \end{bmatrix} \end{equation}

There was a Mathologer video on YouTube which I saw recently which modified this Pascal-triangle based matrix. First, it changed the main diagonal from 1 to 0; then removed the top row; then moved all rows up and added a new row. Then every second diagonal is “decorated” (Burkhard Polster’s words, not mine) with minus signs in the following manner:

    \begin{equation*} \begin{bmatrix} 1& 0& 0& 0& 0 \\ -1& 2& 0& 0& 0 \\ 1& -3& 3& 0& 0 \\ -1& 4& -6& 4& 0 \\ 1& -5&10&-10& 5 \\ \end{bmatrix} \end{equation}

This weird concoction of Pascal’s triangle is based on the coefficients of the expansion of -(1-x)^k, where k is the row number of the matrix counting from 0. Also, the last term, 1, is omitted as stated before. The inverse of this matrix is a fair bit different, but has a special property. When you find the inverse, then multiply by a 5 by 1 matrix consisting of successive powers of n, you get:

    \begin{equation*} \begin{bmatrix} 1& 0& 0& 0& 0 \\ -1& 2& 0& 0& 0 \\ 1& -3& 3& 0& 0 \\ -1& 4& -6& 4& 0 \\ 1& -5&10&-10& 5 \\ \end{bmatrix}^{-1} \times \begin{bmatrix} n \\ n^2 \\ n^3 \\ n^4 \\ n^5 \end{bmatrix} = \begin{bmatrix} 1& 0& 0& 0& 0 \\ \frac{1}{2}& \frac{1}{2}& 0& 0& 0 \\ \frac{1}{6}& \frac{1}{2}& \frac{1}{3}& 0& 0 \\ 0& \frac{1}{4}& \frac{1}{2}& \frac{1}{4}& 0 \\ -\frac{1}{30}& 0& \frac{1}{3}& \frac{1}{2}& \frac{1}{5} \\ \end{bmatrix} \times \begin{bmatrix} n \\ n^2 \\ n^3 \\ n^4 \\ n^5 \end{bmatrix} \end{equation*}

We multiply by the n^r series in order to lead us to the next step, which is to reveal that each row in this matrix make up the coefficients of the sum of a power series after multiplication:

    \begin{align*} S_0 &= \sum_{n=1}^{\infty} 1 = n \\ S_1 &= \sum_{n=1}^{\infty} n = \frac{n}{2} + \frac{n^2}{2} \\ S_2 &= \sum_{n=1}^{\infty} n^2 = \frac{n}{6} + \frac{n^2}{2} + \frac{n^3}{3} \\ S_3 &= \sum_{n=1}^{\infty} n^3 = \frac{n^2}{4} + \frac{n^3}{2} + \frac{n^4}{4} \\ S_4 &= \sum_{n=1}^{\infty} n^4 = -\frac{n}{30} + \frac{n^3}{3} + \frac{n^4}{2} + \frac{n^5}{5} \end{align*}

The payoff here is that you can make a matrix as large as you want to find the summation formulae for all power series ad infinitum. The power series would utilize a 10\times 10 matrix to obtain the power series for S_9:

    \begin{align*} S_9 = \sum_{n=1}^{\infty} n^9 &= 1^9 + 2^9 + 3^9 + 4^9 + ... \\ &= -\frac{3n^2}{20} + \frac{n^4}{2} - \frac{7n^6}{10} + \frac{3n^8}{4} + \frac{n^9}{2} + \frac{n^{10}}{10} \end{align*}

More generally:

    \[ S_m = \sum_{n=1}^{\infty} n^m \]

for any m in the set of integers.

Remarks on LaTeX editors

Hits: 46

Nearly three years ago on another blog, I wrote about a comparison of LaTeX editors. Soon after, I began to use a third editor which, if you are a latex expert, you almost certaintly would have heard about, and are probably in fact using TeXStudio, an editor that has been around for close to a decade, but never appeared to show up on Linux installation packages. The editors that showed up, at least for me, were LyX and TeXmacs.

TeXstudio, once I discovered it, I installed it everywhere I could: on my Windows 10 and 7 machines, on my Linux installations, and even on Cygwin, even though they already had a Windows installation. To this day I have not seen any difference in output or functionality. All invocations of TeXstudio require a lot of time and packages for an installation of enough features.

This is TeXstudio, with the horizontal toolbars shown, along with part of the workspace. There are two vertical toolbars there, also partially shown.

First thing’s first: the editor. In LyX and TeXmacs, I needed to bail out of the editor, and export the code to LaTeX whenever I needed to do any serious equation editing or table editing or the like. In contrast, TeXstudio leaves me with no reason to ever leave the editor. First of all, the editor allows for native latex code to be entered. If there are pieces of Latex code that you don’t know, or have a fuzzy knowledge about, there is probably an icon or menu item that covers it. For document formatting, a menu item leads to a form dialog where you can fill in the form with sensible information pertaining to your particular document, default font size, paper size, margins, and so on. The ouput of this dialog is the preamble section to the LaTeX source file. To the rest of that source file, you add your document and formatting codes.  It is a kind of “notepad” for LaTeX, with syntax highlighting and shortcut buttons, menus and dialogs. It comes close to being WYSIWYG, in that “compiling” the code and pressing  the green “play” button brings up a window with the output of the existing code you are editing. It is not a live update, but it saves you the agony of saving, going on the command line compiling the code, and viewing in seeminly endless cycles. Now you can view the formatted document at the press of the play button.

Relitivistic Pedantry

Hits: 34

I must say first off, that I teach math and computer science, and was never qualified to teach physics. But I am interested in physics, and got drawn into in a physics discussion about how time does not stretch or compress in the visible world, and this is why in most of science, time is always the independent variable, stuck for most practical purposes on the x axis.

In the macroscopic world, time and mass are pretty reliable and so close to Einstein’s formulas (or those associated with the Special and General Theories of Relativity) at the macroscopic level that we prefer to stick to simpler formulas from classical mechanics, since they are great approximations, so long as things move well below the speed of light.

I am not sure (is anyone?) about how time is influenced by things like gravity and velocity (in particluar, the formulas stating how time is a dependent varable with respect to these things), but I remember an equation for relative mass, which doesn’t use time that would provide some insight into relativity:

    \[ \displaystyle{m(v) = lim_{v \to c^-} \frac{m_0}{\sqrt{1 - \frac{v^2}{c^2}}} = \infty} \]

Here, the independent variable is velocity, and it is evident that even for bodies that appear to move fast (on the scale of 10 to 20,000 km/h), it doesn’t have much impact on this equation. Rest mass and relative mass are essentially the same, and a body would have to move at nearly the speed of light for the mass of the moving body to change significantly. Indeed, as velocity v gets closer to the speed of light c, mass shoots up to infinity. I understand that Einstein stated that nothing can move faster than light, and this is supported by the above equation, since that would make it negative under the radical.

It does not escape my notice that velocity is supposed to depend on time, making the function m(v(t)), but time warps under things like high velocity also (as well as high gravity), so that time depends on … ? This is where I tell people to “go ask your physics prof” about anything more involved.

Sattelites move within the range of 10,000 to 20,000 km/h, hundreds of kilometres above the Earth’s surface. My assertion that there is not much change here in relativity terms. But this is still is large enough to keep makers of cell phones up at night, since not considering Einstein equations in time calcluations can cause GPS systems to register errors in a person’s position on the globe on the order of several kilometres, rendering the GPS functions on cell phones essentially useless.

My companion was trying to make the latter point, where I was thinking much more generally. We stick to classical mechanics, not because the equations are necessarily the correct ones, but instead because they are simple and lend a great deal of predictive power to the macroscopic world around us.