Monday, September 3, 2012

DIVISIBILITY OF A NUMBER BY 3,6 OR 9

In school at secondary level, we are used to follow a method to find whether a given number is divisible by 3,6, and 9.
  • Dividing by 3
    1. Add up all the digits in the number.
    2. Find out what the sum is. If the sum is divisible by 3, so is the number
    3. For example: 12123 (1+2+1+2+3=9) 9 is divisible by 3, therefore 12123 is too!
  • Dividing by 6
  1. Add up all the digits in the number.
  2. Find out what the sum is. If the sum is divisible by 3 and 2, the number is divisible by 6.
  3. For example: 12120 (1+2+1+2+0=6) 9 is divisible by 3, therefore 12123 is too!
  • Dividing by 9
  1. Almost the same rule and dividing by 3. Add up all the digits in the number.
  2. Find out what the sum is. If the sum is divisible by 9, so is the number.
  3. For example: 43785 (4+3+7+8+5=27) 27 is divisible by 9, therefore 43785 is too!
Now, knowing the method of finding the divisibility, let's try to prove how this work.

Take the Number that we consider as $P$ and it is represented in standard method as following,

$$ P=a_na_{n-1}a_{n-2}\dots a_{2}a_{1}$$

Where this can be represented accurately as following,

$$P=a_n\times 10^{n-1}+a_{n-1}\times 10^{n-2}+a_{n-2}\times 10^{n-3}+\dots +a_2\times 10^1+a_1\times 10^0$$
or
$$ P=\sum \limits_{r=1}^{n}a_r\times 10^{r-1} \qquad \qquad \dots \mathrm{(A)} $$

case 1: Divisibility of a number by 3

$$\begin{align}
\sum \limits_{r=1}^{n} a_r&=3N \qquad (N\in \mathbb{Z})\qquad \qquad \dots \mathrm{(i)}\\
\sum \limits_{r=2}^{n} a_r+a_1&=3N\qquad \qquad \qquad \dots \mathrm{(a)}\\
a_1&=3N-\sum \limits_{r=2}^{n}a_r\\
\end{align}$$

from (a) and (A)

$$\begin{align}
P&=\sum \limits_{r=2}^{n}a_r \times 10^{r-1} +a_1\\
&=\sum \limits_{r=2}^{n}a_r\times 10^{r-1}+3N -\sum \limits_{r=2}^{n} a_r\\
&=\sum \limits_{r=2}^{n}(a_r\times 10^{r-1}-a_r)+3N\\
&=3N+\sum \limits_{r=2}^{n} a_r(10^{r-1}-1)\\
&=3N+\sum \limits_{r=2}^{n}a_r(9\times \underbrace{111\dots 111}_{(r-1)\,ones})\\
&=3N+9\sum \limits_{r=2}^{n}a_r\left[ \sum \limits_{i=2}^{r}10^{r-i}\right]\\
P&=3\left[ N+3\sum \limits_{r=2}^{n} a_r\left( \sum \limits_{i=2}^{r} 10^{r-i} \right) \right] \\
\end{align}$$

So when the requirement stated in the equation (i) is fulfilled the number - P is devisible by 3.

ii.

$$\sum \limits_{r=1}^{n}a_r=3N$$ and if $$P=2N'\qquad (N,N' \in \mathbb{Z})$$

According to i., P is divisible by 3, but P is also divisible by 2.

From this we can deduct, when above requirements are fulfilled, P is divisible by 6.

iii.

$$\begin{align}
\sum \limits_{r=1}^{n}a_r&=9N \qquad \qquad (N\in \mathbb{Z})\qquad \dots \mathrm{(ii)} \\
\sum \limits_{r=2}^{n}a_r+a_1&=9N \\
a_1&=9N-\sum \limits_{r=2}^{n}a_r\qquad \qquad \dots \mathrm{(b)}\\
\end{align}$$

From (b) and (A),

$$\begin{align}
P&=\sum \limits_{r=2}^{n}a_r\times 10^{r-1}+a_1\\
&=\sum \limits_{r=2}^{n}a_r\times 10^{r-1}+9N-\sum \limits_{r=2}^{n}a_r\\
&=\sum \limits_{r=2}^{n}(a_r\times 10^{r-1}-a_r)+9N\\
&=9N+\sum \limits_{r=2}^{n}a_r(10^{r-1}-1)\\
&=9N+\sum \limits_{r=2}^{n}a_r(9\times \underbrace{111\dots 111}_{(r-1)\,ones})\\
&=9N+9\sum \limits_{r=2}^{n}a_r\left[ \sum \limits_{i=2}^{r}10^{r-i} \right] \\
P&=9\left[ N+\sum \limits_{r=2}^{n}a_r\left( \sum \limits_{i=2}^{r}10^{r-i}\right) \right]\\
\end{align}$$

So when the requirement stated in the equation (ii) is fulfilled the number - P is divisible by 9.

Now, from the above i,ii and iii proofs we can say that when the sum of the digits of a number is equal to 3,9 or even, we can divide it by 3,6 and 9 appropriately. But there can be a situation where the sum of the digits of a large number is also another large number where we cannot directly say that it is divisible by 3 or 9. For example take the number - 11938197159817956982923. The sum of the digits of this number is equal to 123. The sum of the number is also a considerably larger number. In this situation what we do is take the second number and again take the sum of the digits of the number. So, if the sum of the digits of that number is divisible by 3,9 or divisible by 3 and even (in this case we get directly either 3,6 or 9), according to the above proof we can say that the second number is divisible by 3,9 or divisible by 6. If so, according to the above proof we can say that the first number that is given to us in the first place, is also divisible by 3,9 or 6 accordingly.








References

Sunday, August 19, 2012

GRADIENT EXPLAINED IN DETAILS

In vector calculus, the term Gradient is widely used. This mathematical derivation is used to achieve a vector that is perpendicular to a given surface. This geometrical representation is a very important and useful derivation that in use. In this post the idea is to point out a problem to that I've come across in this derivation, and how to clarify it, since the same problem might come across to other peers who study this subject.

The normal derivation goes as follows,

When $\phi(x,y,z)$ represents a scalar field and differentiable for all $x,y,z$

The Gradient is defined as,

$$\nabla \phi = \frac{\partial \phi}{\partial x}\mathbf{i}+\frac{\partial \phi}{\partial y}\mathbf{j}+\frac{\partial \phi}{\partial z}\mathbf{k}$$

Now, let $\vec{r}(t)$ be the position vector of a point on the surface $\phi=c$ (where $c$ is constant).Thus,

$$\vec{r}(t)=x(t)\mathbf{i}+y(t)\mathbf{j}+z(t)\mathbf{k}$$

The vector $\frac{d\vec{r}}{dt}$ is tangent to the surface $\phi =c$ and it can be further represented as,


$$\vec{r}(t)=\frac{dx}{dt}\mathbf{i}+\frac{dy}{dt}\mathbf{j}+\frac{dz}{dt}\mathbf{k}$$


Lets take the dot product of the tangent vector and the gradient.

$$\begin{align}
\nabla \phi \cdot  \left( \frac{d\, \vec{r}(t)}{dt} \right) &= \left(\frac{\partial \phi}{\partial x}\mathbf{i}+\frac{\partial \phi}{\partial y}\mathbf{j}+\frac{\partial \phi}{\partial z}\mathbf{k}\right) \cdot  \left( \frac{dx}{dt}\mathbf{i}+\frac{dy}{dt}\mathbf{j}+\frac{dz}{dt}\mathbf{k} \right)  \\
&=\frac{\partial \phi}{\partial x}\frac{dx}{dt}+\frac{\partial \phi}{\partial y}\frac{dy}{dt}+\frac{\partial \phi}{\partial z}\frac{dz}{dt}\\
\end{align}$$

From multivariable chain rule,

$$\frac{\partial \phi}{\partial x}\frac{dx}{dt}+\frac{\partial \phi}{\partial y}\frac{dy}{dt}+\frac{\partial \phi}{\partial z}\frac{dz}{dt}=\frac{d\phi}{dt}$$

$$\therefore \quad \nabla \phi \cdot \left [\frac{d\, \vec{r}(t)}{dt} \right ] = \frac{d\phi}{dt}$$

since it is stated that $\phi =c$ therefore the derivative of a constant is equal to zero irrespective of the variable.

$$\begin{align}\therefore \quad \nabla \phi \cdot  \left[ \frac{d\, \vec{r}(t)}{dt} \right] &= \frac{d\phi}{dt}\\ &=0 \\ \end{align}$$

Having the dot product of two vector equal to zero we can conclude that these vectors are perpendicular to each other. We know that vector - $\vec{r}(t)$ is tangent to the surface $\phi =c$. Some might say that with this we can conclude that the gradient is perpendicular to the surface. But does this fact is enough to say that the gradient  is perpendicular to the surface? The image says else,

Gradients perpendicular to the tangent vector

This is where one might get stuck. But keep it for a while and look into the lines and surfaces in three dimensional space and their position vector representation in parametric method.

We know that the position vector of a line can be represented with one parameter.

Let's this parameter as $t$ and represent it's position vector by $\vec{r}(t)$.

Now let's look into its derivative and find out its geometrical representation. (This representation is already used in above proof)

Let $AB$ be a chord on the 3-D plane and $\vec{r}(t)$ be the position vector of a point on that chord. $t$ is the parameter which defines the position of the point on the chord.

$$\vec{r}(t)=x(t)\mathbf{i}+y(t)\mathbf{j}+z(t)\mathbf{k}$$

$$\begin{align} \overrightarrow{PQ}&=\overrightarrow{PO}+\overrightarrow{OQ}\\ &=-\vec{r}(t)+[\vec{r}(t)+\Delta \vec{r}(t)]\\ &=\Delta \vec{r}(t)\; [or\; \vec{r}(t+\Delta t)-\vec{r}(t)]\\ \end{align}$$

When $Q \rightarrow P$, $\Delta t \rightarrow 0$ and the line $PQ$ becomes tangent to the curve.Then let's consider $\frac{\Delta \vec{r}(t)}{\Delta t}$

$$\lim_{\Delta t \rightarrow 0} \frac{\Delta \vec{r}(t)}{\Delta t}=\frac{d\, \vec{r}(t)}{dt}$$

$\therefore \frac{d\, \vec{r}(t)}{dt}$ is tangent to the curve.

$$ \frac{d\, \vec{r}(t)}{dt}=\frac{dx}{dt}\mathbf{i}+\frac{dy}{dt}\mathbf{j}+\frac{dz}{dt}\mathbf{k}$$

Let $t=f(u)$ then,
$$ \frac{d\, \vec{r}(t)}{du}= \frac{d\, \vec{r}(t)}{dt}.\frac{dt}{du}$$

Since this is just a multiplication of a scalar, only the modulus value will be changed in the vector. Because of this we can conclude that there exists only one tangent vector to a curve.

Now lets go to a surface.

Please note that $P$,$Q$,$R$ are on the surface.

As mentioned in the one parametric curve following things can be shown,


  • when $Q$ approaches $P$ the $PQ$ line becomes tangent to the surface (same for the $PR$ line).
  • $\overrightarrow{PQ}=\vec{r}(\Delta u,v)-\vec{r}(u,v)$ and  $\overrightarrow{PR}=\vec{r}(u, \Delta v)-\vec{r}(u,v)$
and since,
$$\frac{\partial \vec{r}}{\partial u}=\lim_{\Delta u \rightarrow 0} \frac{\vec{r}(\Delta u,v)-\vec{r}(u,v)}{\Delta u}$$
  • $ \frac{\partial \vec{r}}{\partial u}$ and $ \frac{\partial \vec{r}}{\partial v}$ is tangent to the surface.
Unlike in curves, now we already have two tangents to the surface at a point.

Let $u=f(t,n)$ and $v=g(t,n)$

$$\frac{\partial \vec{r}}{\partial u}\frac{\partial u}{\partial t}+\frac{\partial \vec{r}}{\partial v}\frac{\partial v}{\partial t}=\frac{\partial \vec{r}}{\partial t}\qquad \qquad (1)$$


Consider,

$$\overrightarrow{PQ}=\frac{\partial \vec{r}}{\partial u} \qquad \qquad \overrightarrow{PR}=\frac{\partial \vec{r}}{\partial v}$$

since $\frac{\partial u}{\partial t}$ and $\frac{\partial v}{\partial t}$ are scalars we can take,

$$\overrightarrow{PQ'}=\frac{\partial \vec{r}}{\partial u}\frac{\partial u}{\partial t} \qquad \qquad \overrightarrow{PR'}=-\frac{\partial \vec{r}}{\partial v}\frac{\partial v}{\partial t}$$

then,

$$\begin{align}
\overrightarrow{R'Q'}&=\overrightarrow{R'Q}+\overrightarrow{QP'}\\
&=-\left[ -\frac{\partial \vec{r}}{\partial v}\frac{\partial v}{\partial t}\right] + \frac{\partial \vec{r}}{\partial u}\frac{\partial u}{\partial t} \\ &= \frac{\partial \vec{r}}{\partial u}\frac{\partial u}{\partial t}+\frac{\partial \vec{r}}{\partial v}\frac{\partial v}{\partial t}\\ &=\frac{\partial \vec{r}}{\partial t} \qquad [from (1)]\\ \overrightarrow{R'Q'}&=\frac{\partial \vec{r}}{\partial t}\\ \end{align}$$

We know that $\overrightarrow{PR}$ and $\overrightarrow{PQ}$ vectors are tangent to the surface. So we can conclude that the vector $\overrightarrow{R'Q'}$ also is tangent to the surface. This means the vector $\frac{\partial \vec{r}}{\partial t}$ is tangent to the surface. Similarly, the vector $\frac{\partial \vec{r}}{\partial n}$ is also tangent to the surface.

Since there exists infinitely many $(t,n)$ couples where $u=f(t,n)$ and $v=g(t,n)$. Eventually we can conclude that there are infinitely many tangents to a surface at a point.

Also before going to the original problem let's remind another property in partial differentiation.
i.e.,
$$\frac{du}{dt}=\frac{\partial u}{\partial x}\frac{dx}{dt}+\frac{\partial u}{\partial y}\frac{dy}{dt}$$

where $u=f(x,y)$ and $x=g(t)$ and $y=l(t)$

this can be applied to vectors as,
$$\frac{d\vec{r}}{dt}=\frac{\partial \vec{r}}{\partial x}\frac{dx}{dt}+\frac{\partial \vec{r}}{\partial y}\frac{dy}{dt}$$

we can show that $\frac{d\vec{r}}{dt}$ is a vector which is on the plane where the vectors $\frac{\partial \vec{r}}{\partial t}$ and $\frac{\partial \vec{r}}{\partial n}$ are on.

So now we can clearly see that there are infinitely many $\frac{d\vec{r}}{dt}$ also.

Now lets go back to our original problem.

The answer to the problem that we had here can be easily solved (or rather clarified) with the word which is occasionally used above - "infinitely many".

Let's take the equation,

$$\nabla \phi \cdot  \left( \frac{d\, \vec{r}(t)}{dt} \right) =0$$

Here, $\frac{d\vec{r}}{dt}$ represents infinitely many vectors which is tangent to the surface.

Since these vectors are on the plane which is tangent to the surface, so the gradient is tangent to that surface. Which eventually proves that the gradient is perpendicular to the surface.

So this is my explanation for the gradient. And it is more of a clarification since there is nothing wrong on the proof, but most of us get a bit confused in this.



















Tuesday, August 7, 2012

BINARY NUMBER SYSTEM EXPLAINED

With this post I am publishing my one of the old works that's been done in the year of 2010. This paper is about the binary number system. Mainly it focuses on the 1s compliment and the 2s compliment binary number system. 

This the first post that I am publishing.