Deduce remainder of large numbers [Manual Method]

Often articles are published on Python algorithms in this blog. But today’s article is all about calculating the remainder of two numbers by hand, manually.

When two numbers are divided, it produces two things. One is termed as the Quotient and the other is termed as the Remainder. Based on the application, more focus could be given either to the Quotient or to the Remainder. Today, will focus on the Remainder and find how to deduce the Remainder when a large number is divide by a comparatively small number without doing extensive calculations.

According to the Euclidean division, this can be written as follow:

let x – numerator, y – denominator, k – quotient and r – remainder

x = \displaystyle k*y + r

Using the above equation, will try to find the remainder of 27 / 12.

27 = \displaystyle k*12 + r

It is possible to try applying k = 1 ; k = 2 and then calculate r, at k = 2 we get the answer which is r = 3 . This algorithm is promising, however when the numerator (x) is relatively a large number, more computation is required.

For an example, try to find the remainder of \displaystyle (25^{243}/12)

Assuming this calculation is done by hand, as the numerator is a large number it is not possible to compute the remainder using the above algorithm, of course it is possible but it might take lot of computational steps and time. Therefore another approach is required.

To understand easily, will consider following generalize form; \displaystyle (x^{p}/y)

Algorithm

  1. Break the numerator (x) into two numbers where y needs to be a factor of one of the numbers. Let numbers are a and b, then a = k * y and x = a + b
  2. When there are some combinations available for a and b try to obtain the minimum value for b which satisfies the requirement mentioned in step 1. Obtaining b = 1 is the ideal, if possible.
  3. Once above steps are concluded, the equation reduces to \displaystyle ((a+b)^{p}/y) , further it can be deduce to \displaystyle ((k*y + b)^{p}/y)
  4. Once it is reduced, the remainder can be easily obtained by solving \displaystyle ((b)^{p}/y)
  5. In a scenario where b = 1, then the answer is 1 as \displaystyle ((1)^{p}/y) is always 1.

Getting back to the example mentioned above, \displaystyle (25^{243}/12)

  1. 25 can be broken into 1 and 24, a = 24 and b = 1, 12 become a factor of a therefore the combination satisfies the requirement.
  2. Then solve \displaystyle (1^{243}/12) , which is equal to 1.

Results can be verified with the following python code as well:

<pre>print('Remainder - ',(25**243)%12)</pre>

In such scenarios, where b is not possible to take as 1, it is required to solve the equation numerically. But even though the numerator is reduced, still it requires more computational effort.

Algorithm – part 2

When b is not equal to 1, following method can be used. It follows patterns recognition and then deduce the answer.

To understand the concept behind, will take a slightly different version of the above example, assume that it is required to calculate the remainder of \displaystyle (26^{243}/12)

At this time, as the numerator is 26, it is not possible to break into two numbers in which b = 1. When a = 12, b = 2. Therefore following algorithm needs to be used to deduce the remainder from the reduced equation.

The reduced equation for \displaystyle (29^{243}/12) is \displaystyle (2^{243}/12)

Then take the reduced equation as \displaystyle (2^{p}/12) where p = 243

The next part is identify the pattern by applying p = 1, p = 2, p = 3 ……… This needs to be done until a pattern can be recognized.

at p = 1 \displaystyle (2/12) remainder is 2
at p = 2 \displaystyle (4/12) remainder is 4
at p = 3 \displaystyle (8/12) remainder is 8
at p = 4 \displaystyle (16/12) remainder is 4
at p = 5 \displaystyle (32/12) remainder is 8
at p = 6 \displaystyle (64/12) remainder is 4

A pattern, now can be recognized. It seems when p is odd remainder is 8 and when p is even the remainder is 4 for all p when p>1. As we are looking for the remainder when p = 243 which is an odd number, as a result the remainder should be 8.

Verify the answer with the following python script.

print('Remainder - ',(26**243)%12)

Recognizing the pattern is quite cumbersome but it is always easier than working out the whole equation.

Finally, below is the mathematical proof for the above algorithm:

Mathematical Proof

Let \displaystyle (x^{p}/y) : where y ≠ 0 and x and y are positive real integers.

In Euclidean division, x = k * y + r ———————(1)

applying (1) , \displaystyle ((k*y+r)^{p}/y)

Term (k*y+r), can be treated as binomial expansion as a = k*y and b = r

(a+b)^{p} = \displaystyle c_{1}*a^{p} + c_{2}*a^{p-1}*b + c_{3}*a^{p-2}*b^{2}..... + c_{p-2}*a^{2}*b^{p-2} + c_{p-1}*a*b^{p-1} + b^{p} ———–(2)

In equation no. 2, it can be noticed that each term has a factor of a except the last term, which is \displaystyle b^{p} , that means each term is divisible with no reminder except the last term. Therefore that is the only term which generates a remainder. Calculating the remainder for the last term gives the remainder of the whole equation, that is why it is possible to reduce the original equation to:

\displaystyle ((b)^{p}/y)

Summary

When calculating prime numbers, it is often required to check if a given number has factors. One of the efficient ways is to divide given numbers and check if there is a remainder. For such operations this algorithm can be used specially when the numerator and the denominator are relatively large (in exponent format). Furthermore, if it is possible to break numbers into a and b (step 1 in Algorithm) such a way that b = 1, at a glance the remainder can be obtained. Therefore this is a faster technique that can be mastered to calculate the remainder manually and also can be implemented in computer aided calculations as well.

This article is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported (CC BY-SA 3.0) license. 
Advertisements

Greatest Common Divisor (GDC)

The Greatest Common Divisor (GCD) or Greatest Common Factor is the largest integer which is a common factor of  two or more integers. In other terms, GCD is the largest positive integer that divides each given integer.

For an example, GCD of 20 and 12 is 4. GCD of 18 and 12 is 6. Further, since primes dont have factors (other than 1 and the prime itself) the GCD of any two prime numbers is 1. There is no common factors for 20 and 11, therefore GCD for 20 and 11 is also 1. GCD is not limited to 2 integers, it can be for more than two. For an example, GCD of 30,60 and 90 is 30.

In order to calculate GCD of two numbers following algorithms can be used:

General Method

function cal_gcd(x, y)
Input: Let x and y are two integers

d = min(x,y)
while (True)
    if(x mod d is zero) and (y mod d is zero)
        return d
    else
        d = d - 1

Above algorithm can be used to calculate GCD of two numbers. With a slight modification, the code snippet can be changed so that it calculate GCD for more than two integers.

function cal_gcd_(list)
Input: list of integers
d = min (list)
while (True)
    if remainder = 0 for all integers in the list when divided by d
        d = d -1
    else
        return d

These two algorithms perform better, however once the integers are quite large, these algorithms are not efficient. For large integers, Euclid’s algorithm can be used. Python implementation of the above method mentioned below.

Python Code:

def gcd_gen_list(list_num):
    d = min(list_num)
    cal = True
    while(cal):
        counter = len(list_num)
        for i in range(0, len(list_num)):
            if (list_num[i] % d != 0) :
                d -= 1
                break
            else:
                counter -= 1
        if((d==1) or (counter == 0)):
            return d

Euclid’s algorithm

This is a pretty interesting method. This method is based on the divisibility concept.

Let, x is divided by y, so that the result is k and remainder is r. In such a case it can be expressed as;

x = k . y + r

Plus this method uses the following theorem.

GCD of integer x and y is equal to GCD of integer y and r.

Repeating this concept till remainder reaches zero.

Pseudocode algorithm:

function gcd_euc
Input: Let x and y are integers

calculate r (r = x mod y)
while (r is not 0)
   calculate r (r = y mod r)
return r

This method is pretty straight forward and very fast when compared to the method mentioned above for large integers.

Python code:

def gcd_euc(x, y):
    r = x%y
    while (r != 0):
        x = y
        y = r
        r = x%y
    return int(y)

Dijkstras Algorithm

This is another algorithm which can be used to compute GCD of two integers. It uses subtraction of numbers to calculate the GCD.

Pseudocode algorithm:

function gcd_dijk
Input: Let x and y are integers

while (x != y)
   If x > y Then
       x = x - y
   Else:
       y = y - x
return x

Python code:

def gcd_dijk(x, y):
    while(x!=y):
        if(x>y):
            x = x-y
        else:
            y = y-x
    return x

Binary method

The Binary method also known as Stein’s algorithm is also one of the algorithms to compute GCD. It is quite more complex than Dijkstras Algorithm. However unlike
Dijkstras Algorithm it uses division by 2, therefore it is possible to use bit operations.

Pseudocode algorithm:

function gcd_binary
Input: Let x and y are integers

while (x != y)
   factor = 1

   If x is 0 Then
       return factor * y
   If y is 0 Then
       return factor * x

   If x is even AND y is even Then
       factor = factor * 2
       x = x / 2
       y = y / 2

   If x is even AND y is not even Then
       x = x / 2

   If x is not even and y is even Then
       y = y / 2

   If x is not even AND y is not even Then
       If x > y Then
           x = (x - y ) /2
       Else
           y = (y - x) / 2
    
    return factor * x

Python code:

Python implementation is provided below. Note that bit-wise operator >> and << have been used instead of multiplication of 2 or division by 2.

def gcd_binary(x, y):

    factor = 1
    while(x!=y):

        if (x==0 or y==0):
            return factor*(x+y)

        if (is_even(x) == False and is_even(y) == False):
            if(x>y):
                x = (x-y) >> 1
                continue
            else:
                y = (y-x) >> 1
                continue

        if(is_even(x) and is_even(y)):
            x = x >> 1
            y = y >> 1
            factor = factor << 1 continue if(is_even(x)==True and is_even(y)==False): x = x >> 1
            continue
        else:
            y = y >> 1
            continue

    return factor * x

def is_even(x):
    y = x >>1
    if(y<<1==x):
        return True
    else:
        return False

All methods other than the General Method can be used to calculate GCD for 2 integers at once. In order to calculate GCD for more than two integers, it is possible to calculate GCD for pairs and then select the lowest GCD for all the pairs.

Python code:

def gcd_list(numList):
    numListSize = len(numList)
    GCDList = list()
    for i in range(0, numListSize):
        for j in range(0, numListSize):
            if(i!=j):
                ans = gcd_binary(numList[i], numList[j])
                GCDList.append(ans)
    return min(GCDList)

All methods can be found in bmaths library under bmaths_gcd.py
bmaths library is released under GNU General Public License v3.0

Local Authority Election 2018 – Parsing Results (Python Script)

The official results of the Local Authority Election 2018 just released via https://election.news.lk/ . If any one is looking for a script to parse the results, check the below link.

https://github.com/bckurera/elec_res_parse

The direct connection socket to the site has been removed. Therefore follow below steps unless you want to add your own socket to read the site (check my earlier post on Python Socket programming):

  1. Open the relevant result page and save it in your local PC.
  2. Rename the file name to 98.html (or change the file name in the script)
  3. Execute the script.
This script has been released under GNU GENERAL PUBLIC LICENSE (Version 3)

Socket programming in Python

Python, in default offers low-level access to network services as many other languages do. This is often required when developing client-server applications or an application which needs to communicate with another service. Therefore in this article, it is discussed, how socket programming can be achieved in Python.

Low-Level Access

In this approach, python library socket is used. It is a part of the standard Python library, hence no manual installation is required.

Server code

This is a simple server which keeps listening to an incoming traffic from a client and then respond.

#!/usr/bin/python

import socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

HOST = '127.0.0.1'
PORT = 30303
BUFFER_SIZE = 2014

s.bind((HOST, PORT))

s.listen(5)
while True:
   print ('server running --')
   conn, addr = s.accept()
   data = conn.recv(BUFFER_SIZE)
   print ('Got connection from ', data, '-', addr)
   conn.send(b'Thank you for connecting')
   conn.close()

Note how the socket object has been initialized and then HOST address and the PORT have been defined. bind( ) method reserves the port for the host. accept( ) method accepts the incoming connection and then output another instance of the socket object as conn and the addr holds the address (and the port) of the incoming request.

When sending data using send( ) method, the content should be a byte-like object. No string objects can be used. That is why b literal is used. Or string.encode( ) can also be used here. The rest is pretty straight forward.

Client Code

Following is the code snippet for the client.
Code is almost as same as the server code other than not having a loop to listen to the incoming traffic. It simply send some data to the server and then receives the output from the server.

#!/usr/bin/python

import socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
HOST = '127.0.0.1'
PORT = 30303

s.connect((HOST, PORT))
s.send(b'username:user')
data = s.recv(1024)
print (data)
s.close ()

The server code needs to be executed first and then the client code.

However, since there is no threads in the server code, only 1 connection can be established with the server at a time.

Requesting a web page

It is possible to use the client code to contact a web server (or any other service) and request a web page. Or even contact a FTP service. The send request needs to be modified according to the protocol.

Following is a simple example on getting a web page using the client code. Localhost is used in the code however the HOST can be replaced with any URL which supports HTTP.

#!/usr/bin/python

import socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
HOST = '127.0.0.1'
PORT = 80

s.connect((HOST, PORT))
s.send(b'GET /test/index.php HTTP/1.1\n'
       b'Host: 127.0.0.1\n'
       b'Connection: keep-alive\n'
       b'Upgrade-Insecure-Requests: 1\n'
       b'\r\n')

data = s.recv(1024)
print (data)
s.close ()

Notice that only the send method has been changed to facilitate HTTP protocol. The output is a plain-text including header and body content. Further processing is required.

High-Level Access

For HTTP protocol, httplib module can be used too. However it is not a part of the standard Python library and it is required to get it installed manually. In the same manner, few non-standard libraries are available for FTP (ftplib), SMTP (smtplib), POP3 (poplib) protocols.

This is a simple introduction on socket programming in Python. According to your requirement the code needs to be modified. The intention was to demonstrate how Python can be used for the above mentioned purpose.

Flick – a new time unit for VR

Recently, the Facebook Open Source has announced that they have launched a new time unit called flick[1]. It captures the attention of many tech communities around the world. But why it is that cool? In this post, will discuss how it is derived using simple mathematical concepts.

The video sampling is measured by the frame rate, for general use it is frames fer second or for high speed motions capturing, frames per millisecond. That means number of frames displayed per time unit. 24 fps (frames per second) is one of the most common frame rate for films. That means 24 frames will be captured/ projected in a second, 24 images in a second.

Following video frame rates with 1/1000 subdivisions are considered when deriving this new unit, flick.

24 fps, 25 fps, 30 fps, 48 fps, 50 fps, 60 fps, 90 fps, 100 fps, 120 fps

when converted to numbers, considering 1/1000 sub divisons:

24 000, 25 000, 30 000, 48 000, 50 000, 60 000, 90 000, 100 000, 120 000

Then not only video, audio is also sampled. In the following manner.

8 kHz, 16 kHz, 22.05 kHz, 24 kHz, 32 kHz, 44.1 kHz, 48 kHz, 88.2 kHz, 96 kHz, 192 kHz

When converted into numbers.

8 000, 16 000, 22 050, 24 000, 32 000, 44 100, 48 000, 88 200, 96 000, 192 000

The new time unit is chosen in a such a way that the above rates can be represented with no fractions, the result is a full integer value. It can be noticed that it is inevitable getting fractions even a nano-second is used as the smallest time unit.

If the new value is f then following equation should be the new representation:

flick value representation = f / (video or audio sample rate)

To find out f, Least Common Multiple (LCM) should be calculated in following numbers.

24 000, 25 000, 30 000, 48 000, 50 000, 60 000, 90 000, 100 000, 120 000, 8 000, 16 000, 22 050, 24 000, 32 000, 44 100, 48 000, 88 200, 96 000, 192 000

However, it can be noticed at once, that the number list can be reduced before applying LCM. Because 48 is a multiple of 24, 90 is multiple of 30, therefore the list reduces as follow :(eliminate smaller number which is factor of a larger number)

90 000, 100 000, 120 000, 88 200, 192 000

then after, it is possible to prime factorize above numbers: (you may use the following calculator[3])

90 000 = 2 x 2 x 2 x 2 x 3 x 3 x 5 x 5 x 5 x 5 = 2^4 x 3^2 x 5^4
100 000 = 2 x 2 x 2 x 2 x 2 x 5 x 5 x 5 x 5 x 5 = 2^5 x (5^5)
120 000 = 2 x 2 x 2 x 3 x 5 = 2^3 x 3 x 5
88 200 = 2 x 2 x 2 x 3 x 3 x 5 x 5 x 7 x 7 = 2^3 x (3^2) x 5^2 x (7^2)
192 000 = 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 x 3 x 5 x 5 x 5 = (2^9) x 3 x 5^3

According to the method, the next step is to extract higher power primes.

= 2^9 x 3^2 x 5^5 x 7^2
= 512 x 9 x 3125 x 49
f = 705 600 000

If a flick is defined as one, 705 600 000th of a second, all above mentioned rates can be divided without getting any fractions as the result. The result is an integer always.

Further, a flick is nearly 1.4 times larger than a nano-second.

f = (1/ 705 600 000) second
f = 1.41723356 e-9 second

A video with a common rates such as 24 fps (video sampling rate) and 44.1 kHz (audio sampling rate) can now be expressed as 29 400 000 flicks (video rate) and 16 000 flicks (audio rate). Or even it can be denoted 29.4 mega-flicks and 16 kilo-flicks. (could not find any reference for using mega or kilo with flicks anyway)

That is how, the new unit, flick enables conversion of rates without any lose of information of the video sampling or the audio sampling. That is why it becomes a cool representation. C++ implementation can be found in GitHub[2]

[1] http://www.bbc.com/news/technology-42787529
[2] https://github.com/OculusVR/Flicks
[3] https://www.calculatorsoup.com/calculators/math/prime-factors.php

Get Free Air Tickets [Hoax]

These days, getting free stuffs from businesses is not an uncommon thing, even from airlines. There are plenty of offers out there. One of my friends has forwarded the following message in WhatsApp.

Screenshot_20180115-072511

Free 2 tickets, wow ! I could not wait till I finished reading the message. Because it is all about 2 free tickets from the national carrier. This is unbelievable. So I did check the URL, first it seems that the URL is as same as the official URL of the carrier which is srilanka.com. Everything seems pretty cool. So I read it again and checked the URL. Then it flipped. The URL is srilankán.com , notice the letter á, instead of a.

If you visit the website, it looks as follow. It looks real, almost real, even the logo is also there.

Screenshot_20180115-072428

You need to provide some answers, basically YES and NO for 4 questions and congratulations, you secured 2 free tickets. In the next screen, you need to send this to your WhatsApp contacts. Then after you can claim your 2 free tickets.

Screenshot_20180115-072454

This URL wont work for desktop browsers, it keeps saying that the offer is not valid for the region while it gets directed to the following URL http://promopage.life/tick/g.php. The reason is pretty simple because it targets the mobile users as it needs WhatsApp to spread the news.

This is not a very smart phishing attack though it is mediocre. The attacker has matched the URL, it is so hard to notice the difference. The web site looks real too. However the Facebook section is not working at all. The connection is not secured (https). This is why you need to check for https always, make it a habit.

Although the offer of 2 free tickets raises your eyebrows, at the same time, it rings a bell. Because it is hard to believe that an airline is just throwing 2 free tickets for a simple survey like this. It would feel real, if it was like 50% for tickets or somewhat.

Finally, to avoid such malicious hoax, make sure you check the URL before you click it. Then look for https, a secure connection. Think before you share anything, specially when you are asked to share something via facebook, WhatsApp, Viber and etc. Last not the least, make sure you use your common sense too.

EDIT : Having https doesnt prove the authenticity. But not having https should ring a bell. So dont get confused. Checking for https (SSL EV) would be  good test.

Did you get the same message? If so what did you do?

Intuition of zero

Zero is my favorite number after i. This number, zero is strange. The concept is mind blowing. Same as the infinity, thanks to God, the infinity is not a number but a concept. In contrast, zero is a number. So we need to deal with it everyday. That is why, zero becomes one of my favorite numbers. And it is possible to talk about zero for hours.

Lets check basic four operators; addition, subtraction, multiplication and division against this strange number, zero.

Addition and Subtraction

Lets assume that you are planning a treat for your friends. You buy 5 toffees. Earlier you had no toffees. But now you have 5 toffees. Mathematically it can be denoted as

= 0 + 5 = 5

You have 5 toffees but your friends dont like the flavor, so they didnt take any. That can be denoted as;

= 5 – 0 = 5

Multiplication

Taking back the same example, you have 5 friends and if you are planning to buy 2 toffees per friend, you need to buy 5 * 2 = 10 toffees. Then your mind changes, you are planning to buy a chocolate and a toffee per friend. Then you will need to buy 5 * 1 = 5 toffees only. But if you change your mind and decide that you buy 2 chocolates per friend, then you need to buy 5 * 0 = 0 toffees and 5 * 2 = 10 chocolates. This makes sense. As you have 10 chocolates, your friends get 10 / 5 = 2 chocolates. Further since you have no toffees your friends get 0 / 5 = 0 toffees.

Therefore it is safely concluded that, addition, multiplication of 0 wont change the value. Multiplication by zero makes any value 0. If any value is divided by zero then it is zero again.

So far the maths align with our intuition.

Multiplication as Addition

Multiplication is a special form of addition. For an example 3 * 5 means adding 5, three times. As multiplication is commutative 5 * 3 gives the same results but as a convention it can be taken as adding 3, five times.

5 * 3 = 5 + 5 + 5 = 15 or 3 * 5 = 3 + 3 + 3 + 3 + 3 = 15

Then 5 * 0 can be taken as adding 0, five times. 0 + 0 + 0 + 0 + 0 = 0, however according to the convention 0 * 5 becomes senseless. Adding 5 zero times, meaning nothing is being done.

Division as Subtraction

Division is also a special form of subtraction. It says how many subtractions should be performed to reach zero. For an example 6 / 2 can be denoted as 6 – 2 – 2 – 2 , so it needs 3 subtractions, hence 6 / 2 = 3

In the same manner, 0 / 5 = 0 because 0 has already reached to zero and no subtraction is required.

So far zero is behaving rationally. Now will see how wired zero can become under certain circumstances.

Division by Zero

It is a fact that you know, when a number is divided by a small number the result gets very large. When the number becomes smaller the result gets much more larger. 0 is the absolute smallest number. Therefore, if a number is divided by zero then it should become the infinity. This is quite intuitive though it is not correct.

Lets take an analogy. You have to distribute 10 chocolates among 5 friends. One friend takes 2 chocolates . Then 8 chocolates left for 4 friends. Still 8 / 4 = 2. Then two more friends takes. Now you have 4 chocolates and 2 more friends to take. Another one takes 2 chocolates now just one friend and 2 chocolates, once the final friend takes 2 remaining chocolates, you have no friends to come and no chocolates to distribute. So no one gets a chocolates, as there are no chocolates to distribute and at the same time there is no friends left to get any chocolates. Therefore, following make no sense at all, does it suggest the infinity or zero. It suggests neither of them.

(no friends) /  (no toffees)

Consider division as a series of subtraction, as we checked earlier. Example: take 5 / 0. How many times 5 should be subtracted by zero so that the final answer to reach 0. It can be noted that it will never reach to 0.

5 – 0 – 0 ………………………………………………. – 0 – 0 ≠ 0

That is one of the ways to demonstrate 0 / 0 non-existence, why any number is divided by zero is not infinity. Therefore in mathematics, division by zero is not determinable, considered as an invalid operation. That is why before dividing by any number we make the assumption that the number is not equal to zero. It reaches to the infinity, but it never gets there. Calculus should be used to deal with such situations, but it is not in the scope of this article.

Multiplication zero by zero

Intutively, zero times zero would equal to zero. Because when a number is multiplied by zero, the result becomes zero. But there is an issue.

Coming back to the toffee example, it is decided to buy chocolates instead of toffees. The treat needs 10 chocolates as there are 5 friends and one gets two chocolates.  But how many toffees to buy. All friends got chocolates therefore there is no friend to get toffees and at the same time you have not decided to give toffees, therefore it sounds like 0 * 0. Does it make sense, if so above example on 0 / 0 should make sense as well.

On the other hand, we noted that 5 * 0 = 0 + 0 + 0 + 0 + 0,

then, 4 * 0 = 0 + 0 + 0 + 0

and 3 * 0 = 0 + 0 + 0
2 * 0 = 0 + 0
1 * 0 = 0
but what is 0 * 0 = ?

Anyhow, if you can remember, this issue occurs on 0 * 5 as well but taking commutative property, 0 *5 considered as 5 * 0. Here it has no meaning as it becomes 0 * 0 again.

That is why both 0 * 0 and 0 / 0 are counter intuitive.

Is 0 * 0, indeterminate?

In an instance, 0 * 0 becomes indeterminate. Check the following proof.

take 3 numbers such that x * y = z

then assign x = 0;

as we already know that any number multiplied by zero is zero, when x = 0

0 * y = 0 ——————————(B)

y can be any number, then divide the equation by y.

0 = 0 / y ———————————-(A)

Now you will realize, equation A can only be true if y is not equal to 0, when y is equal to 0 equation A cannot be true. It is illegal, that means in equation B, solution y = 0 does not exist. That means, 0 * y = 0 true only if y ≠ 0 only.

When 0 * 0 Becomes 0

It is known fact that, x * x reaches to zero when x is reaching to zero. But it never gets value zero. But in most equations it is easy to take 0 * 0 as 0. Even in some instances x / 0 can be considered as the infinity. Even 0 / 0 is common in calculus, it is not taken as not defined in calculus. In fact it is the begging of calculus. The answer changes as the hat you are wearing, mathematician, engineer, physicists and etc…

Therefore where you use the expression it can get the related meaning. But based on basic mathematics, it can be seen that 0 * 0 cannot be defined. There is no much harm if it is taken as 0 * 0 = 0 as well. But it cannot be generalized. This affects indexes of 0 as well. 0^2 ≠ 0 and generally 0 ^ n ≠ 0 where n > 0. This should be discussed in another article.

How this is started ?

Recently, I found an interesting question on Quora. Two numbers are such that their sum is equal to their product. What are these two numbers?

Intuitively, it seems like 0,0 and 2,2 are the solutions but 0,0 is not (as 0 * 0 ≠ 0 + 0 but 2 * 2 = 2 + 2). That started the argument on what is 0 * 0 and this is my explanation on that.

Conclusion

I believe 0 * 0 is not 0. This is what I believe and the basis is explained above. This is open for discussions, please feel free to add your thoughts as well.