Inner and Outer product in Linear Algebra

Let’s take two coordinate vectors, \textbf v and \textbf u. Both of them can be represented as column matrices (why not as row matrices?) of order m \times 1 and n \times 1.

The inner product of these two coordinate vectors is, \textbf v^T \cdot \textbf u.

\textbf v = \begin{pmatrix} a_1 \\ a_2 \\ a_3\\...\\a_m \end{pmatrix}

\textbf v^T = \begin{pmatrix} a_1 & a_2 & a_3 & ... & a_m \end{pmatrix}

\textbf u = \begin{pmatrix} b_1 \\ b_2 \\ b_3\\...\\ b_n \end{pmatrix}

\textbf v^T \cdot \textbf u = \begin{pmatrix} a_1 & a_2 & a_3& ... & a_m \end{pmatrix} \cdot \begin{pmatrix} b_1 \\ b_2 \\b_3 \\ ... \\b_n \end{pmatrix}

\textbf v^T \cdot \textbf u = ( a_1 b_1 + a_2 b_2 + a_3 b_3 + ... + a_m b_n)

Notice that it only works if m = n and it always results in a matrix of order 1 \times 1.

The outer product of these two vectors is \textbf v \cdot \textbf u^T.

\textbf v \cdot \textbf u^T = \begin{pmatrix} a_1 \\ a_2 \\ a_3 \\ ... \\ a_m \end{pmatrix} \cdot \begin{pmatrix} b_1 & b_2 & b_3 & ... & b_n \end{pmatrix}

\textbf v \cdot \textbf u^T = \begin{pmatrix} a_1 b_1 & a_1 b_2 & a_2 b_3 &...&a_1 b_n\\a_2 b_1 & a_2 b_2 & a_2 b_3 &...& a_2 b_n\\a_3 b_1 & a_3 b_2 & a_3 b_3 &...&a_3 b_n\\...& ... & ... & ... & ... \\a_m b_1 & a_m b_2 & a_m b_3 & ... & a_m b_n \end{pmatrix}

If you have a column vector of order m \times 1 and a row vector of order 1 \times n respectively, their outer product will be a matrix of order m \times n. Here m need not be equal to n.

The significance of inner product in quantum mechanics becomes clear right away, but what about the outer product?

To be continued in the next article: Inner and Outer Product in Quantum Mechanics

A complex-looking simple problem

I would like to share the solution of a very simple problem. I tried solving it during an exam. It looked really complex (to me) at first but then I finally did it!

Problem: There is a square of side r. There are two circles drawn with radius equal to the side of the square. What is the probability of a particle to be found in the shaded (yellow) region?

Usually when we solve the probability problems (not that I am an expert), the formula that we use is, (number of desired items e.g. red balls) divided by (total number of items e.g. red and yellow balls). Similarly, here we can use, (area of shaded region) divided by (total area). To calculate it, we need to figure out the area of the yellow region.

It can be seen, that there are two circles here. And the area of circle is, \pi r^2, but the circle inside the square is just \frac{1}{4}^{th}, so area of first circle inside the square is, \frac{1}{4} \pi r^2. The area of square itself will be r^2. Now if we subtract the area of the circle from the square, we get the area of one purple region. r^2 - \frac{1}{4} \pi r^2 = r^2(1 - \frac{\pi}{4} ). The area of second purple region will also be the same, and hence the total area is, 2 [r^2(1 - \frac{\pi}{4})]. In the end what we need to do is, subtract this from the area of square to get the area of yellow region. Which is going to be, r^2 - 2 [r^2(1 - \frac{\pi}{4})] = -r^2 + \frac{\pi}{2}r^2.

Finally, we can get the probability of the particle to be found in the yellow region, which is, \frac{[-r^2 + \frac{\pi}{2}r^2]}{r^2} = \frac{\pi}{2} - 1.

Remembering Hawking

The series “In to the Universe with Stephen Hawking”, when first premiered world wide in 2010 really kindled my interest in him. He introduced me to Black holes, and made me aware of my existence in this universe.

I have read (or at least tried reading) most of his books. Especially “A brief history of time” really made me realize why I was studying anything in the first place; to understand the universe we live in. The George book series he wrote with her daughter Lucy was also interesting; perhaps my first ever sci-fi series (if we exclude “The little Prince” which I read in Hindi). George’s parents were basically environmentalists and used to eat most of the things grown in their garden. But George was not very supportive of that fact. The drawings were also really beautiful and made the story more alive. The first time George accidentally goes to Eric’s house, trying to find Freddy, his pig; there he meets Annie and her parents Susan & Eric. On his very first interaction with Eric, they talk about how a charged scale attracts water towards it. He also gets to see Eric’s magical computer, Cosmos. It has this feature of opening a portal to any part of the universe. And later, Annie and George secretly go on many adventures. Like their rather reckless trip to Saturn’s moon Enceladus; they even rescue Eric when he falls into a Black hole. In another book of the series, Annie, George and Eric sit back and witness the creation of whole universe unfolding through the portal created by world’s smartest computer, Cosmos.

I was very excited when I read the explanation of Hawking radiation in brief history but sadly it’s flawed. The discovery certainly is really interesting. There is a somewhat nice and detailed description by Ethan Siegel but unfortunately, we can never fully comprehend or appreciate the concept until we read and understand quantum field theory and general theory of relativity in detail.

I was also really fascinated by the nautilus shown in “The Grand Design”. The way these books described things was so different from any text book I had ever read before. Mainly the things about origin and fate of the universe, like why do we exist and where do we come from struck me so deeply at that time and still do.

Blogroll: 2020

Why most Hacktoberfest PRs are from India : The author of this post has tried to show all of his frustration throughout this article. Its rather long, but very well written. I’m glad that someone took the trouble to type it all out. I don’t really want to add anything but would like to say that I agree with the views of the author.

The Butterfly Life Cycle : I came to know a very rare aspect of Adonis Blue butterfly through this post. Usually, the caterpillars form a chrysalis attached to the plant (to make it look like a leaf), but the caterpillars of Adonis Blue take very different route. Their caterpillars are adopted by ants! Ants take them to their nest because they smell and sound like the ant larvae. But sadly, when these caterpillars are there, they eat ant’s larvae too. There are similar ant-butterfly interactions found in nature all over the world.

Math reading challenge 2020

So, I found this article by Evelyn lamb in her blog Roots of Unity at the end of 2019. It had some prompts to help you find math related books. I wasn’t able to complete all of them but I did try some.

I read three books for the prompt, “A work of fiction in which a main character is a mathematician“. The very first book I read was, “The devotion of suspect X“. It was beautiful. Set in Japan, it’s about a mathematician Ishigami, who is a High school teacher. One day, when he was trying to take his life, someone rings the doorbell. His new neighbors, Yasuko and her daughter Misato. Without knowing, they save his life. And from that point, he does everything to protect this family next door. It’s mysterious, and very emotional at times. Next was, “The Housekeeper and the Professor“. Due to a terrible accident in 1970, a mathematician is now only able to remember last 80 minutes of his life. Like a hard disk which has only 80 minutes of memory limit; anything new is recorded on top of that. So whenever he wakes up in morning, he doesn’t remember a single thing that happened yesterday. Many housekeepers are assigned to take care of him but no one lasts. But it’s about to change. The tenth housekeeper, who is the youngest in the company takes the job and then starts a story of friendship between the housekeeper, her son and the professor. They go on many trips and he tells them interesting things like the importance of square root, amicable numbers, perfect numbers, triangle numbers etc. But the good days come to an end. His 80 minute memory tape is also broken and he cannot retain even a minute of new memories. Sadly, in the end, he is transferred to a new care facility. Then I read “Uncle Petros and Goldbach’s Conjecture“. Its story revolves around a mathematician who is obsessed with the Goldbach’s conjecture (Every even number greater than 2 can be written as a sum of prime numbers). And how he puts in so much effort to discourage his nephew from pursuing higher mathematics, because he doesn’t want him to get mad and obsessed like himself. It also has a very tragic ending.

For the next prompt, “A graphic novel about math or mathematicians“, I read “Logicomix: An Epic Search for Truth“. It had really awesome script and beautiful drawings. I read about Russel’s paradox for the first time in it, which is introduced by Bertie Russell himself. It goes something like this, if a set consists of all the sets that do not contain themselves, then does that set contain itself as an element? If it does then it does not follow the property that it should not contain itself; If it doesn’t contain itself then it does follow the property and thus it belongs to the set but then again if it does it shouldn’t and if it doesn’t then it should.

For the most part, the story follows the life of Bertrand Russell. There are many events of his life from childhood to a university student; how he started questioning everything that others took for granted. It also contains many dialogues and fictional meetings between famous mathematicians, which makes it even more interesting.

logicomix
Logicomix

So basically, all I read was mathematical fiction. But I did learn some concepts in number theory and logic here and there.

A little peek into the world of spiders

Today we will talk about a class of animals, called Arachnids. They are easily distinguished from insects by their four pair of legs. Unlike insects, which are plenty in almost every part of the world, Arachnids are less in number. And out of many different animal species which come under the class of Arachnids, spiders are largest.

So, how these spiders find their food? As we all know, their solution to this problem is, constructing a web. Spider cannot be everywhere at the same time, but a net or a web increases its reach and can catch more insects.

Different species of spiders exist and different types of web shapes also. Some species do not build web at all, and some build circular webs, funnel shaped webs, tangled cobwebs, triangular webs etc. But let’s focus on a circular or orb web for now.

orb weaving spider
An Orb-weaver spider

So, how does an orb-weaver spider actually make its delicate web? Surprisingly, the whole process takes about an hour or two. It has nearly seven to eight different silk producing organs (or spinnerets) underside, and there are different glands connected to it for producing silk of varying protein composition. These different types of silk are used in making different parts of the web.

The process, more or less goes something like this: first, the spider starts by flying a silk thread like a kite. The thread is very light and if there is a soft blowing wind, it clings to some surface. It spins another thread and walks along the previous thread tying it down there again. Then it travels to the middle of this second thread and due to its weight the thread takes a V like shape. There, it starts another thread, which it then ties down to some leaf or branch. So now we have a Y like shape. The three spokes of the web are ready. The next step would be to draw all remaining spokes from the center of Y in all directions, called radial threads. After completing the spokes it builds a spiral from center to outward. Then walking along that spiral again, it builds another spiral from outside which is sticky.

A beautiful depiction of how a spider builds and tunes all the threads of its web

Now that we have a perfect orb-web, how do we know that it’s actually going to work. Let’s say a little insect flies into it, it may tear the entire web. So, to catch the insects, the web should be elastic. And it should be sticky too otherwise the insect may bounce off the web. And, the good thing is that the spiders have solution to all these problems.

We know that the spiral part of the web is sticky. When you zoom into these sticky silk thread, you will find a lot of bead like structures there, which are actually tangled threads inside a drop of liquid. The liquid is not just water but a sticky glue and hence it serves two purposes: the tangled threads of the spider silk inside the liquid gives it extra length, and it also helps in capturing the flying insects which stick to it.

A close-up view of the sticky silk thread

In the end, let’s talk about the gossamer silk, another fine and very light silk produced by spiders. Some spiders use it to fly, which is known as spider ballooning. Spider first checks the air current using one of its legs and then shoots the silk threads. Within seconds it’s flying in the air. Although, it’s not quite obvious if spiders can actually control where the silk threads will take them, yet they cover very large distances.

A beautiful video showing how spiders fly using the silk threads


This blog post is inspired by Silken Fetters, a chapter from Richard Dawkins’ awesome book, Climbing Mount Improbable

Meeting a spiderling

While drinking tea this morning I noticed something moving on the dinner table. It was really tiny so also very cute. It was a “spiderling”, as I later found the exact word to call it by when I googled. It felt like she (or he?) is just now getting familiar with her abilities, like a superhero/girl getting out to test their superpowers. So as any superhero does, she jumped out of the table suddenly and now she was dangling down to the side of the table, the silk she was using was invisible but it was there. There was a breeze coming from the kitchen window, she started climbing towards the table again. A few moments later she jumped off again and started climbing down, I also knelt down to see her.

I find spiders quite scary but she was really small so there was not even a pinch of scariness. As I knelt down, she threw a few of her silk threads on my T shirt while she was still hovering in the middle of the air, hanging at half the table length. I could feel it because when I moved my hand she came towards me. Finally she was able to touch the floor and started moving towards the kitchen. I followed her for a few seconds and then decided to keep her somewhere safe. My tea was already finished, and I was also googling about how people feed their pet spiderlings.

It was hard to locate her because she was so tiny, I got scared that I would lose her trail, so I took out a glass from kitchen and laid it in front of her. To my surprise, she happily (not sure if she can actually feel anything like that) jumped inside. I kept a paper on top of it using tape to hold it in its place. I was a bit scared that it will be too hot for her inside the glass. But I couldn’t let her go so, kept her inside for sometime. I also started googling while watching her move around. I found that people buy special food for their spiderling pet.

I couldn’t identify her, but it felt like a tiny version of a jumping spider I had seen before, which is called Lynx spider but I’m still not sure. I also found that the best way to give water to your spiderling is by spraying it on their enclosure wall otherwise they will drown. I had a bit of water in my glass from night, and a pencil lying around. So I used the pencil to make small droplets of water and a bit of juice on the side of glass. She went towards the juice droplet and probably had a sip or two. I couldnt tell, because the droplet size was similar to her. After sometime, I decided that I wont be able to take care of her, because she would need to eat insects also. So I went out and lowered the glass on a leaf and she jumped out of the glass happily. I saw her for a bit and then she disappeared.

The life cycle of all spiders starts with eggs, then after hatching, the spiderlings mold many times to become full adult spider. So she still has to mold many times and grow.

Dark Matter

One evening, out of curiosity I started watching a video lecture “Dark Matter and Galaxy Rotation” by Dr. Bob Eagle. After watching it, I got motivated to learn about this topic in a little more detail. I found a series of videos by theoretical physicist Sabine Hossenfelder on dark matter (Part 1, 2, 3) which are also really awesome. Another video showing a debate between scientists on similar topics was quite interesting to watch.


From classical mechanics, we know that the balance between sun’s gravitational force and centripetal force keeps the planets from flying away from their orbits. Assuming that all planets move in circular orbits we can equate these two factors, the gravitational force on the left and centripetal force on the right:

\frac{G M_s m_p}{r^2} = \frac{m_p v^2}{r}

v^2 = \frac{G M_s}{r}

According to this relation, the speed v of planets decreases as their distance r from sun increases. This inverse relation is visible in the graph below. Its also known as the rotation curve.

Rotation Curve for the Solar System

Now, if we see the rotation curve for a galaxy we would expect it to be similar. But that’s not what was observed. The rotation curve of different galaxies show this similar property that the velocity of stars does not decrease as we move away from the galactic center.

Rotation curve of spiral galaxy M33: Wikimedia Commons

As per the relation, if the distance from the center increases, the velocity of stars should decrease but it doesn’t. If the velocity of stars is as high as it has been measured then they should just fly off. Because the gravitational force from the stars is not enough to balance the centripetal force. We can assume that the mass keeps increasing as we move farther from the center so that the term \frac{M}{r} remains constant. But if it is true then where is all the extra mass?

Surprisingly, when the mass of the different galaxies was calculated using gravitational lensing it was found to be greater than what was calculated from the total mass of the stars. This extra mass is now thought to spread evenly throughout the galaxy in halos and is called dark matter.

A very famous theory called MOND or Modified Newtonian Dynamics was used to explain this observation. It modifies Newtonian Gravity by assuming that at low accelerations, the relation F \propto \frac{1}{r} should be used instead of \frac{1}{r^2} but this theory has long been ruled out because of many reasons, one of them is that Newtonian gravity already works for planets and stars very well.

In the end, I would love to quote Sabine Hossenfelder:

Dark matter is a model which fits the data and observations to some extent and that’s how science works.

Apparent size

Sitting at the dining table, once I was calculating how planets appear to the human eye from our planet. I was trying to calculate the angular diameter or apparent size of planets using trigonometry. I have no idea where that notebook is, but today, I found an awesome blog which gave me enough background to start doing some calculations again.

This time I am going to calculate the apparent size of ISS. I have seen it floating across the sky a few times.

Angular diameter, \delta = 2 sin^{-1} \frac{D}{2d}
d: Distance of ISS from Earth = 400 km
D: Length of ISS = 109 m
\delta: angular diameter of ISS = ?
\delta = 2 sin^{-1} \frac{109}{2 \times 400 \times 10^3}
= 2 sin^{-1} (0.000136)
= 2 \times 0.0079 = 0.0156 \deg
0.0156 \deg = 0.9 arcminute
Its almost equal to the apparent diameter given on Wikipedia, which is 1 arcminute.