Friday, March 6, 2015

Motion in a plane,Displacement Vector,Triangular Inequality and Dijkstra’s Algorithm,Greedy optimal Strategy for Search,Bellman-Ford Algorithm

A vector quantity is a quantity that has both a magnitude and a direction and obeys the triangle law of addition or equivalently the parallelogram law of addition. So, a vector is specified by giving its magnitude by a number and its direction. Some physical quantities that are represented by vectors are displacement, velocity, acceleration and force.
Position and Displacement Vectors
To describe the position of an object moving in a plane, we need to choose a convenient point, say O as origin. Let P and P′ be the positions of the object at time t and t′ , respectively as shown below
We join O and P by a straight line. Then, OP is the position vector of the object at time t. An arrow is marked at the head of this line. It is represented by a symbol r, i.e. OP = r. Point P′ is represented by another position vector, OP′ denoted by r′ . The length of the vector r represents the magnitude of the vector and its direction is the direction in which P lies as seen from O. If the object moves from P to P′ , the vector PP′ (with tail at P and tip at P′ ) is called the displacement vector corresponding to motion from point P (at time t) to point P′ (at time t′ ). It is important to note that displacement vector is the straight line joining the initial and final positions and does not depend on the actual path undertaken by the object between the two positions. For example, in Fig b, given the initial and final positions as P and Q, the displacement vector is the same PQ for different paths of journey, say PABCQ, PDQ, and PBEFQ. Therefore, the magnitude of displacement is either less or equal to the path length of an object between two points.
Vectors and Vector Addition :
We start with the simplest of all vector quantities: displacement. Displacement is simply a change in position of an object, which we will assume can be treated as a pointlike particle. In Figure 1.6a, we represent the object’s change in position by an arrow that points from the starting position to the ending position.Displacement is a vector quantity because we must state not only how far the particle
moves, but also in what direction.Walking 3 km north from your front door doesn’t get you to the same place as walking 3 km southeast.We usually represent a vector quantity, such as a displacement, by a single  letter, such as A as shown below
A displacement is always a straight-line segment, directed from the starting
point to the endpoint, even though the actual path of the object may be curved. In
Figure b,the displacement is still A, even though the object takes a roundabout
path. Also, note that displacement is not related directly to the total distance traveled. If the particle makes a round trip, returning to its starting point as shown in Figure c, the displacement for the entire trip is zero.

Displacement is a vector quantity. A displacement vector represents a change in position (distance and direction) of an object from one point in space to another.





Displacement is the Shortest path between any two given points.Light always follow the shortest path Algorithm in free space ie it takes the shortest distance between any given two points.

The Routing Algorithm is Also based upon finding the shortest path among the given n paths,The light can do it in the space but how can a router choose the shortest path from Ni point Ni+1 when it has M different possibilities.So Router will follow an Algorithm called Dijkstra algorithm which is based upon Triangular inequality.First we will know Dijkstra algorithm and then Mathematics behind this called Triangular inequality that will lead to Artificial intelligence optimal Solution Path.
Djikstra's algorithm (named after its discover, E.W. Dijkstra) solves the problem of finding the shortest path from a point in a graph (the source) to a destination. It turns out that one can find the shortest paths from a given source to all points in a graph in the same time, hence this problem is sometimes called the single-source shortest paths problem. 
This problem is related to the spanning tree one. The graph representing all the paths from one vertex to all the others must be a spanning tree - it must include all vertices. There will also be no cycles as a cycle would define more than one path from the selected vertex to at least one other vertex. For a graph,
G = (V,E) where
  • V is a set of vertices and
  • E is a set of edges.
Dijkstra's algorithm keeps two sets of vertices:
S the set of vertices whose shortest paths from the source have already been determined and
V-S the remaining vertices.
The other data structures needed are:
d array of best estimates of shortest path to each vertex
 pi  an array of predecessors for each vertex.

The basic mode of operation is:
  1. Initialise d and pi,
  2. Set S to empty,
  3. While there are still vertices in V-S,
    1. Sort the vertices in V-S according to the current best estimate of their distance from the source,
    2. Add u, the closest vertex in V-S, to S,
    3. Relax all the vertices still in V-S connected to u

Relaxation

The relaxation process updates the costs of all the vertices, v, connected to a vertex, u, if we could improve the best estimate of the shortest path to v by including (u,v) in the path to v. The relaxation procedure proceeds as follows:
initialise_single_source( Graph g, Node s )
   for each vertex v in Vertices( g )
       g.d[v] := infinity
       g.pi[v] := nil
   g.d[s] := 0;
This sets up the graph so that each node has no predecessor (pi[v] = nil) and the estimates of the cost (distance) of each node from the source (d[v]) are infinite, except for the source node itself (d[s] = 0). 

Note that we have also introduced a further way to store a graph (or part of a graph - as this structure can only store a spanning tree), the predecessor sub-graph - the list of predecessors of each node,
pi[j], 1 <= j <= |V|
The edges in the predecessor sub-graph are (pi[v],v)
Now,
The relaxation procedure checks whether the current best estimate of the shortest distance to v (d[v]) can be improved by going through u (i.e. by making u the predecessor of v):
relax( Node u, Node v, double w[][] )
    if d[v] > d[u] + w[u,v] then
       d[v] := d[u] + w[u,v]
       pi[v] := u
The algorithm itself is now:
shortest_paths( Graph g, Node s )
    initialise_single_source( g, s )
    S := { 0 }        /* Make S empty */
    Q := Vertices( g ) /* Put the vertices in a PQ */
    while not Empty(Q) 
        u := ExtractCheapest( Q );
        AddNode( S, u ); /* Add u to S */
        for each vertex v in Adjacent( u )
            relax( u, v, w ) 
Another Interpretation for above Algorithm which involves more Mathematics is as following  
Single-Source Shortest Path Problem:
The problem of finding shortest paths from a source
vertex v to all other vertices in the graph.
! Weighted graph G = (E,V)
! Source vertex s ∈ V to all vertices v ∈ V 
What is Dijkstra’s Algorithm:
Solution to the single-source shortest path problem in graph theory ! Both directed and undirected graphs ! All edges must have nonnegative weights ! Graph must be connected as shown in the figure below .....

Pseudocode :

 

 Output of Dijkstra’s Algorithm:
Original algorithm outputs value of shortest path not the path itself ! With slight modification you can obtain the path Value: δ(1,6) = 6 Path: {1,2,5,6}
What is the mathematics behind it that it is working and the answer is Triangular inequality leading to optimal strategy for search Algorithm.
Lemma 1: Optimal Substructure The subpath of any shortest path is itself a shortest path. ! 
Lemma 2: Triangle inequality If δ(u,v) is the shortest path length between u and v, δ(u,v) ≤ δ(u,x) + δ(x,v) .

Proof of Correctness 1 :
  * Invariant: d[v] ≥ δ(s,v) for all v ∈ V
  *Holds after initialization and any sequence of relaxation steps
Proof :Hint: We will need the relaxation part of the pseudocode. 

d[v] <-- d[u] + w(u,v), Updation will take place iff Triangular inequality Rule.
Proof of Correctness 1.5  :

Relaxation step not only maintains the invariant but allows us to find next shortest path 
Suppose s --> ... --> u --> v is a shortest path 
* If d[u] = δ(s,u)  

*And we relax edge (u,v) 
Then d[v] = δ(s,v) after relaxation  
Proof 

Proof of Correctness 2 :
When Dijkstra terminates,  
d[v] = δ(s,v) for all v ∈ V 
Proof
Hint: We will need min-extraction part of the pseudocode.  
                          u ← mindistance(Q,dist)

 Applications of Dijkstra’s Algorithm:
1)Packet Routing in Data communication Physical layer communication.
2)Light Follow Dijkstra’s Algorithm in free space but it breaks down under intense Gravitational Field.Why?

Algorithms for calculating shortest path from source to sink about as computationally expensive as calculating shortest paths from source to any vertex .
Currency Exchange Problem  :
Is there an arbitrage opportunity? ! Ex. $1 # 1.3941 Francs # 0.9308 Euros # $1.00084  

Vertex = currency, edge = transaction 
 ! Weight = exchange rate
 ! Find path that maximizes product of weights # reduce to sum of  weights
 ! Is there a negative cost cycle?

 Bellman-Ford Algorithm:
Works for negative weights :
Detects a negative cycle if any exist ! Finds shortest simple path if no negative cycle exists If graph G = (V,E) contains negative-weight cycle, then some shortest paths may not exist. 

Come to Actual Greedy Algorithms  (Dijkstra’s shortest path algorithm) implementation Step by step you can Apply this Algorithm anywhere where you have to find the shortest path eg Routing a packet through Router Data communication.

Given a graph and a source vertex in graph, find shortest paths from source to all vertices in the given graph.
Dijkstra’s algorithm is very similar to Prim’s algorithm for minimum spanning tree. Like Prim’s MST, we generate a SPT (shortest path tree) with given source as root. We maintain two sets, one set contains vertices included in shortest path tree, other set includes vertices not yet included in shortest path tree. At every step of the algorithm, we find a vertex which is in the other set (set of not yet included) and has minimum distance from source.
Below are the detailed steps used in Dijkstra’s algorithm to find the shortest path from a single source vertex to all other vertices in the given graph.
Algorithm
1) Create a set sptSet (shortest path tree set) that keeps track of vertices included in shortest path tree, i.e., whose minimum distance from source is calculated and finalized. Initially, this set is empty.
2) Assign a distance value to all vertices in the input graph. Initialize all distance values as INFINITE. Assign distance value as 0 for the source vertex so that it is picked first.
3) While sptSet doesn’t include all vertices
….a) Pick a vertex u which is not there in sptSetand has minimum distance value.
….b) Include u to sptSet.
….c) Update distance value of all adjacent vertices of u. To update the distance values, iterate through all adjacent vertices. For every adjacent vertex v, if sum of distance value of u (from source) and weight of edge u-v, is less than the distance value of v, then update the distance value of v.

Let us understand with the following example:


The set sptSetis initially empty and distances assigned to vertices are {0, INF, INF, INF, INF, INF, INF, INF} where INF indicates infinite. Now pick the vertex with minimum distance value. The vertex 0 is picked, include it in sptSet. So sptSet becomes {0}. After including 0 to sptSet, update distance values of its adjacent vertices. Adjacent vertices of 0 are 1 and 7. The distance values of 1 and 7 are updated as 4 and 8. Following subgraph shows vertices and their distance values, only the vertices with finite distance values are shown. The vertices included in SPT are shown in green color.
      
Pick the vertex with minimum distance value and not already included in SPT (not in sptSET). The vertex 1 is picked and added to sptSet. So sptSet now becomes {0, 1}. Update the distance values of adjacent vertices of 1. The distance value of vertex 2 becomes 12.


Pick the vertex with minimum distance value and not already included in SPT (not in sptSET). Vertex 7 is picked. So sptSet now becomes {0, 1, 7}. Update the distance values of adjacent vertices of 7. The distance value of vertex 6 and 8 becomes finite (15 and 9 respectively).
Pick the vertex with minimum distance value and not already included in SPT (not in sptSET). Vertex 6 is picked. So sptSet now becomes {0, 1, 7, 6}. Update the distance values of adjacent vertices of 6. The distance value of vertex 5 and 8 are updated.
We repeat the above steps until sptSet doesn’t include all vertices of given graph. Finally, we get the following Shortest Path Tree (SPT).


 Let's code all this Sequence of steps in C++ code as follows

// A C / C++ program for Dijkstra's single source shortest path algorithm.
// The program is for adjacency matrix representation of the graph
#include <stdio.h>
#include <limits.h>
// Number of vertices in the graph
#define V 9
// A utility function to find the vertex with minimum distance value, from
// the set of vertices not yet included in shortest path tree
int minDistance(int dist[], bool sptSet[])
{
   // Initialize min value
   int min = INT_MAX, min_index;
   for (int v = 0; v < V; v++)
     if (sptSet[v] == false && dist[v] <= min)
         min = dist[v], min_index = v;
   return min_index;
}
// A utility function to print the constructed distance array
int printSolution(int dist[], int n)
{
   printf("Vertex   Distance from Source\n");
   for (int i = 0; i < V; i++)
      printf("%d \t\t %d\n", i, dist[i]);
}
// Funtion that implements Dijkstra's single source shortest path algorithm
// for a graph represented using adjacency matrix representation
void dijkstra(int graph[V][V], int src)
{
     int dist[V];     // The output array.  dist[i] will hold the shortest
                      // distance from src to i
     bool sptSet[V]; // sptSet[i] will true if vertex i is included in shortest
                     // path tree or shortest distance from src to i is finalized
     // Initialize all distances as INFINITE and stpSet[] as false
     for (int i = 0; i < V; i++)
        dist[i] = INT_MAX, sptSet[i] = false;
     // Distance of source vertex from itself is always 0
     dist[src] = 0;
     // Find shortest path for all vertices
     for (int count = 0; count < V-1; count++)
     {
       // Pick the minimum distance vertex from the set of vertices not
       // yet processed. u is always equal to src in first iteration.
       int u = minDistance(dist, sptSet);
       // Mark the picked vertex as processed
       sptSet[u] = true;
       // Update dist value of the adjacent vertices of the picked vertex.
       for (int v = 0; v < V; v++)
         // Update dist[v] only if is not in sptSet, there is an edge from
         // u to v, and total weight of path from src to  v through u is
         // smaller than current value of dist[v]
         if (!sptSet[v] && graph[u][v] && dist[u] != INT_MAX
                                       && dist[u]+graph[u][v] < dist[v])
            dist[v] = dist[u] + graph[u][v];
     }
     // print the constructed distance array
     printSolution(dist, V);
}
// driver program to test above function
int main()
{
   /* Let us create the example graph discussed above */
   int graph[V][V] = {{0, 4, 0, 0, 0, 0, 0, 8, 0},
                      {4, 0, 8, 0, 0, 0, 0, 11, 0},
                      {0, 8, 0, 7, 0, 4, 0, 0, 2},
                      {0, 0, 7, 0, 9, 14, 0, 0, 0},
                      {0, 0, 0, 9, 0, 10, 0, 0, 0},
                      {0, 0, 4, 0, 10, 0, 2, 0, 0},
                      {0, 0, 0, 14, 0, 2, 0, 1, 6},
                      {8, 11, 0, 0, 0, 0, 1, 0, 7},
                      {0, 0, 2, 0, 0, 0, 6, 7, 0}
                     };
    dijkstra(graph, 0);
    return 0;
}
Output:
Vertex   Distance from Source
0                0
1                4
2                12
3                19
4                21
5                11
6                9
7                8
8                14
Notes:
1) The code calculates shortest distance, but doesn’t calculate the path information. We can create a parent array, update the parent array when distance is updated (like prim’s implementation) and use it show the shortest path from source to different vertices.
2) The code is for undirected graph, same dijekstra function can be used for directed graphs also.
3) The code finds shortest distances from source to all vertices. If we are interested only in shortest distance from source to a single target, we can break the for loop when the picked minimum distance vertex is equal to target (Step 3.a of algorithm).
4) Time Complexity of the implementation is O(V^2). If the input graph is represented using adjacency list, it can be reduced to O(E log V) with the help of binary heap. We will soon be discussing O(E Log V) algorithm as a separate post.
5) Dijkstra’s algorithm doesn’t work for graphs with negative weight edges. For graphs with negative weight edges, Bellman–Ford algorithm can be used, we will soon be discussing it as a separate post.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Let's come to physics and see vectors Application in different branches of  Science and Technology.First study vectors in the general form then i will talk about its application in different fields. 
At this moment you must appreciate that to understand Algorithms you should also have the knowledge of vectors.


 


however, is not equal  to A because its direction is opposite to that of A We define the negative of a vector as a vector having the same magnitude as the original vector but the opposite direction. The negative of vector quantity A is denoted as -A and we use a boldface minus sign to emphasize the vector nature of the quantities.
We usually represent the magnitude of a vector quantity (in the case of a displacement vector, its length) by the same letter used for the vector, but in light italic type with no arrow on top. An alternative notation is the vector symbol with vertical bars on both sides:
The magnitude of a vector quantity is a scalar quantity (a number) and is always positive 

Vector Addition and Subtraction 
Suppose a particle undergoes a displacement A followed by a second displacement B.The final result is the same as if the particle had started at the same initial
point and undergone a single displacement C as shown below.
We call displacement C the vector sum, or resultant, of displacements A and B.
 We express this relationshipsymbolically as 
C=A+B  or
This triangle law of vector addition is universal it can ve applied to any two non zero vectors to find its resultant sum vector as follows
Commutative Law of vector addition.

If we combine the above two condition we can derive the parallelogram law of vector addition.
We can also add them by constructing a parallelogram as following.

More details can be found in next paper.
Electronics And Communication by Md Tauseef Ibrahim/Abraham malik click the link here:http://electronicsandcommunicationadvancedma.blogspot.in/2015/03/3g-networksorthogonal-frequency.html

Tuesday, March 3, 2015

Vector Algebra,Cross product,Dot Product and application of vector calculus in physics and Biology,Velocity in a Plane.


Today we will learn vectors and vector Calculus that finds great application in Mechanics and particle dynamics. Vector calculus deals with the rate of change of vector with respect to the domain upon which vector depends so if vector depends upon time then rate of change of difference vector with respect to time gives velocity vector means linear combination of velocity along X and Y direction V=Vxi+Vyj=dr/dt,where r=dXi+dYj is the difference vector which we are going to see now. Before dealing with vector calculus lets deal with vectors in the light of motion in a plane. 
Velocity in a Plane:
To describe the motion of an object in a plane, we first need to be able to describe the object’s position Often, it’s useful to use a familiar x-y axis system as shown in the Figure

  For example, when a football player kicks a field goal, the ball (represented by point P) moves in a vertical plane. The ball’s
horizontal distance from the origin O at any time is x, and its vertical distance above the ground at any time is y. The numbers x and and y are called the coordinates of point P.The vector r from the origin O to point P is called the position vector of point P, and the Cartesian coordinates x and y of point P are the x and y components, respectively, of vector r.The distance of point P from the origin is the magnitude of vector r

Where X= r*cos(theta) and Y=r*sin(theta) in polar Coordinate system as shown below
Converting between polar and Cartesian coordinates:
The polar coordinates r and ϕ can be converted to the Cartesian coordinates x and y by using the trigonometric functions sine and cosine:
x = r \cos \varphi \,
y = r \sin \varphi \,
The Cartesian coordinates x and y can be converted to polar coordinates r and ϕ with r ≥ 0 and ϕ in the interval (−π, π] by:
r = \sqrt{x^2 + y^2} \quad (as in the Pythagorean theorem or the Euclidean norm), and
\varphi = \operatorname{atan2}(y, x) \quad,
where atan2 is a common variation on the arctangent function defined as
\operatorname{atan2}(y, x) =
\begin{cases}
\arctan(\frac{y}{x}) & \mbox{if } x > 0\\
\arctan(\frac{y}{x}) + \pi & \mbox{if } x < 0 \mbox{ and } y \ge 0\\
\arctan(\frac{y}{x}) - \pi & \mbox{if } x < 0 \mbox{ and } y < 0\\
\frac{\pi}{2} & \mbox{if } x = 0 \mbox{ and } y > 0\\
-\frac{\pi}{2} & \mbox{if } x = 0 \mbox{ and } y < 0\\
\text{undefined} & \mbox{if } x = 0 \mbox{ and } y = 0
\end{cases}
The value of ϕ above is the principal value of the complex number function arg applied to x+iy. An angle in the range [0, 2π) may be obtained by adding 2π to the value in case it is negative.

 Let's consider a particle in this polar or Cartesian Coordinate system is at point P1 and moves to P2 as shown in the following figure

The above figure shows the ball at two points in its curved path.At time t1 it is at a point P1with position vector r1,at the later time t2 it is at the point P2 with position vector r2.The ball moves from Point P1 to P2 during a time interval del t=t2--t1.The change in position (the displacement) during this interval is the vector

We can relate this difference vector to average velocity simply by dividing this difference vector by the time change required to take place this change.
Let's understand the concept of Average velocity: Above figure in pink shows us that.

 
So what if we want to find the velocity at a particular instant of time to understand this we require to understand the concept of differential calculus:
The concept of instantaneous velocity and the differential calculus.
To understand instantaneous velocity ie the velocity at a point in the path of motion we require to understand the slope of tangent to the curve at that point .To understand the concept of slope of a tangent to a curve we have to understand Derivative of a function at any poin P(x,y) .And To understand Derivative of a function we require to understand a branch of differential calculus called Limit of a function means approximate value of a function when Domain X-->a, Where a must lie within domain and we write it mathematically as a (-Domain .


We define the instantaneous velocity as follows: 
 The two velocity components for motion in the x-y plane





At every point along the path, the instantaneous velocity vector is
tangent to the path.


 Because velocity is a vector quantity, we may represent it either in terms of its components or in terms of its magnitude and direction,
The direction of an object’s instantaneous velocity at any point is always tangent to the path at that point. But in general, the position vector r does not have the same direction as the instantaneous velocity v (The direction of the position vector r depends on where you place the origin, while the direction of is determined by the shape of the path.)

Acceleration in a Plane:
Observe the figure given below

Average acceleration is a vector quantity in the same direction as the vector, we stressed that acceleration is a quantitative description of the dv.



We define the instantaneous acceleration vector(a) at point P1 as shown in the following figure as follows

Again to understand the concept of instantaneous acceleration we require to apply the concept of Limit from differential calculus.
Let's understand instantaneous acceleration:


The instantaneous acceleration vector at point P1 as shown in the above figure does not have the same direction as the instantaneous velocity vector V at that point in general,there is no reason it should. ( The velocity and acceleration components of a particle moving along a line could have opposite signs also.)The construction in above Figure shows that the acceleration vector must always point toward the concave side of the curved path. When a particle moves in a curved path, it always has nonzero acceleration, even when it moves with constant speed. More generally, acceleration is associated with change of speed change of direction of velocity, or both.












  













We often represent the acceleration of a particle in terms of the components of this vector quantity.


 Two special cases a) acceleration parallel to object's velocity
                               b)acceleration orthogonal to object's velocity



Cross product as vector quantity
Let's learn Cross product because it's having huge application in physics to find moment of a force that is also called Torque defined as vector(r)cross*vector(F)=Torque which is a vector quantity having magnitude and direction.
So if you have been given two vectors a and b. then
vec(a)crossvec(b)=a*b*sin(angle between a and b)n, Where n is a unit vector orthogonal to both vector a and b ,as curl is taken anti clockwise direction as shown graphically



.
Finding the direction of the cross product by the right-hand rule
The cross product of two vectors a and b is defined only in three-dimensional space and is denoted by a × b. In physics, sometimes the notation ab is used, though this is avoided in mathematics to avoid confusion with the exterior product.
The cross product a × b is defined as a vector c that is perpendicular to both a and b, with a direction given by the right-hand rule and a magnitude equal to the area of the parallelogram that the vectors span.
The cross product is defined by the formula
\mathbf{a} \times \mathbf{b} = \left\| \mathbf{a} \right\| \left\| \mathbf{b} \right\| \sin \theta \ \mathbf{n}
where θ is the angle between a and b in the plane containing them (hence, it is between 0° and 180°), ‖a‖ and ‖b‖ are the magnitudes of vectors a and b, and n is a unit vector perpendicular to the plane containing a and b in the direction given by the right-hand rule (illustrated). If the vectors a and b are parallel (i.e., the angle θ between them is either 0° or 180°), by the above formula, the cross product of a and b is the zero vector 0.

The cross product a × b (vertical, in purple) changes as the angle between the vectors a (blue) and b (red) changes. The cross product is always perpendicular to both vectors, and has magnitude zero when the vectors are parallel and maximum magnitude ‖a‖‖b‖ when they are perpendicular.
By convention, the direction of the vector n is given by the right-hand rule, where one simply points the forefinger of the right hand in the direction of a and the middle finger in the direction of b. Then, the vector n is coming out of the thumb (see the picture on the right). Using this rule implies that the cross-product is anti-commutative, i.e., b × a = −(a × b). By pointing the forefinger toward b first, and then pointing the middle finger toward a, the thumb will be forced in the opposite direction, reversing the sign of the product vector.
Using the cross product requires the handedness of the coordinate system to be taken into account (as explicit in the definition above). If a left-handed coordinate system is used, the direction of the vector n is given by the left-hand rule and points in the opposite direction.This, however, creates a problem because transforming from one arbitrary reference system to another (e.g., a mirror image transformation from a right-handed to a left-handed coordinate system), should not change the direction of n

According to Sarrus' rule, the determinant of a 3×3 matrix involves multiplications between matrix elements identified by crossed diagonals
In 1881, Josiah Willard Gibbs, and independently Oliver Heaviside, introduced both the dot product and the cross product using a period (a . b) and an "x" (a x b), respectively, to denote them.
In 1877, to emphasize the fact that the result of a dot product is a scalar while the result of a cross product is a vector, William Kingdon Clifford coined the alternative names scalar product and vector product for the two operations. These alternative names are still widely used in the literature.Both the cross notation (a × b) and the name cross product were possibly inspired by the fact that each scalar component of a × b is computed by multiplying non-corresponding components of a and b. Conversely, a dot product a · b involves multiplications between corresponding components of a and b. As explained below, the cross product can be expressed in the form of a determinant of a special 3×3 matrix. According to Sarrus' rule, this involves multiplications between matrix elements identified by crossed diagonals.

Computing the cross product


Standard basis vectors (i, j, k, also denoted e1, e2, e3) and vector components of a (ax, ay, az, also denoted a1, a2, a3)
The standard basis vectors i, j, and k satisfy the following equalities:
\begin{align}
  \mathbf{i} &= \mathbf{j}\times\mathbf{k}\\
  \mathbf{j} &= \mathbf{k}\times\mathbf{i}\\
  \mathbf{k} &= \mathbf{i}\times\mathbf{j}
\end{align}
which imply, by the anticommutativity of the cross product, that
\begin{align}
 \mathbf{k\times j} &= -\mathbf{i}\\
 \mathbf{i\times k} &= -\mathbf{j}\\
 \mathbf{j\times i} &= -\mathbf{k}
\end{align}
The definition of the cross product also implies that
\mathbf{i}\times\mathbf{i} = \mathbf{j}\times\mathbf{j} = \mathbf{k}\times\mathbf{k} = \mathbf{0}
These equalities, together with the distributivity and linearity of the cross product (but both do not follow easily from the definition given above), are sufficient to determine the cross product of any two vectors u and v. Each vector can be defined as the sum of three orthogonal components parallel to the standard basis vectors:
\begin{align}
  \mathbf{u} &= u_1\mathbf{i} + u_2\mathbf{j} + u_3\mathbf{k} \\
  \mathbf{v} &= v_1\mathbf{i} + v_2\mathbf{j} + v_3\mathbf{k}
\end{align}
Their cross product u × v can be expanded using distributivity:
 \begin{align}
 \mathbf{u}\times\mathbf{v} = {} &(u_1\mathbf{i} + u_2\mathbf{j} + u_3\mathbf{k}) \times (v_1\mathbf{i} + v_2\mathbf{j} + v_3\mathbf{k})\\
                            = {} &u_1v_1(\mathbf{i} \times \mathbf{i}) + u_1v_2(\mathbf{i} \times \mathbf{j}) + u_1v_3(\mathbf{i} \times \mathbf{k}) + {}\\
                                 &u_2v_1(\mathbf{j} \times \mathbf{i}) + u_2v_2(\mathbf{j} \times \mathbf{j}) + u_2v_3(\mathbf{j} \times \mathbf{k}) + {}\\
                                 &u_3v_1(\mathbf{k} \times \mathbf{i}) + u_3v_2(\mathbf{k} \times \mathbf{j}) + u_3v_3(\mathbf{k} \times \mathbf{k})\\
\end{align}
This can be interpreted as the decomposition of u × v into the sum of nine simpler cross products involving vectors aligned with i, j, or k. Each one of these nine cross products operates on two vectors that are easy to handle as they are either parallel or orthogonal to each other. From this decomposition, by using the above-mentioned equalities and collecting similar terms, we obtain:
\begin{align}
 \mathbf{u}\times\mathbf{v} = {} &u_1v_1\mathbf{0} + u_1v_2\mathbf{k} - u_1v_3\mathbf{j} - {}\\
                                 &u_2v_1\mathbf{k} - u_2v_2\mathbf{0} + u_2v_3\mathbf{i} + {}\\
                                 &u_3v_1\mathbf{j} - u_3v_2\mathbf{i} - u_3v_3\mathbf{0} \\
                            = {} &(u_2v_3 - u_3v_2)\mathbf{i} + (u_3v_1 - u_1v_3)\mathbf{j} + (u_1v_2 - u_2v_1)\mathbf{k}\\
\end{align}
meaning that the three scalar components of the resulting vector s = s1i + s2j + s3k = u × v are
\begin{align}
  s_1 &= u_2v_3-u_3v_2\\
  s_2 &= u_3v_1-u_1v_3\\
  s_3 &= u_1v_2-u_2v_1
\end{align}
Using column vectors, we can represent the same result as follows:
\begin{pmatrix}s_1\\s_2\\s_3\end{pmatrix}=\begin{pmatrix}u_2v_3-u_3v_2\\u_3v_1-u_1v_3\\u_1v_2-u_2v_1\end{pmatrix}

Matrix notation



Use of Sarrus' rule to find the cross product of u and v
The cross product can also be expressed as

\mathbf{u\times v}=\begin{vmatrix}
\mathbf{i}&\mathbf{j}&\mathbf{k}\\
u_1&u_2&u_3\\
v_1&v_2&v_3\\
\end{vmatrix}
This determinant can be computed using Sarrus' rule or cofactor expansion. Using Sarrus' rule, it expands to
\mathbf{u\times v}=(u_2v_3\mathbf{i}+u_3v_1\mathbf{j}+u_1v_2\mathbf{k})
-(u_3v_2\mathbf{i}+u_1v_3\mathbf{j}+u_2v_1\mathbf{k}).
Using cofactor expansion along the first row instead, it expands to
\mathbf{u\times v}=
\begin{vmatrix}
u_2&u_3\\
v_2&v_3
\end{vmatrix}\mathbf{i}
-\begin{vmatrix}
u_1&u_3\\
v_1&v_3
\end{vmatrix}\mathbf{j}
+\begin{vmatrix}
u_1&u_2\\
v_1&v_2
\end{vmatrix}\mathbf{k}
which gives the components of the resulting vector directl

Geometric meaning of Cross product says that it has direction hence it is a vector.



Figure 1. The area of parallelogram as the magnitude of a cross product

Figure 2. Three vectors defining a parallelepiped
The magnitude of the cross product can be interpreted as the positive area of the parallelogram having a and b as sides 
A = \left\| \mathbf{a} \times \mathbf{b} \right\| = \left\| \mathbf{a} \right\| \left\| \mathbf{b} \right\| \sin \theta. \,\!
Indeed, one can also compute the volume V of a parallelepiped having a, b and c as sides by using a combination of a cross product and a dot product, called scalar triple product (see Figure 2):

\mathbf{a}\cdot(\mathbf{b}\times \mathbf{c})=
\mathbf{b}\cdot(\mathbf{c}\times \mathbf{a})=
\mathbf{c}\cdot(\mathbf{a}\times \mathbf{b}).
Since the result of the scalar triple product may be negative, the volume of the parallelepiped is given by its absolute value. For instance,
V = |\mathbf{a} \cdot (\mathbf{b} \times \mathbf{c})|.
Because the magnitude of the cross product goes by the sine of the angle between its arguments, the cross product can be thought of as a measure of perpendicularity in the same way that the dot product is a measure of parallelism. Given two unit vectors, their cross product has a magnitude of 1 if the two are perpendicular and a magnitude of zero if the two are parallel. The converse is true for the dot product of two unit vectors.
Unit vectors enable two convenient identities: the dot product of two unit vectors yields the cosine (which may be positive or negative) of the angle between the two unit vectors. The magnitude of the cross product of the two unit vectors yields the sine (which will always be positive).

Algebraic properties



  • If the cross product of two vectors is the zero vector (i.e. a × b = 0), then either one or both of the inputs is the zero vector, (a = 0 and/or b = 0) or else they are parallel or antiparallel (ab) so that the sine of the angle between them is zero (θ = 0° or θ = 180° and sinθ = 0).
  • The self cross product of a vector is the zero vector, i.e., a × a = 0.
  • The cross product is anticommutative,
\mathbf{a} \times \mathbf{b} = -\mathbf{b} \times \mathbf{a},
  • distributive over addition,
\mathbf{a} \times (\mathbf{b} + \mathbf{c}) = (\mathbf{a} \times \mathbf{b}) + (\mathbf{a} \times \mathbf{c}),
  • and compatible with scalar multiplication so that
(r\mathbf{a}) \times \mathbf{b} = \mathbf{a} \times (r\mathbf{b}) = r(\mathbf{a} \times \mathbf{b}).
  • It is not associative, but satisfies the Jacobi identity:
\mathbf{a} \times (\mathbf{b} \times \mathbf{c}) + \mathbf{b} \times (\mathbf{c} \times \mathbf{a}) + \mathbf{c} \times (\mathbf{a} \times \mathbf{b}) = \mathbf{0}.
Distributivity, linearity and Jacobi identity show that the R3 vector space together with vector addition and the cross product forms a Lie algebra, the Lie algebra of the real orthogonal group in 3 dimensions.
  • The cross product does not obey the cancellation law: that is, a × b = a × c with a0 does not imply b = c, but only that:
 \begin{align}
\mathbf{0} &= (\mathbf{a} \times \mathbf{b}) - (\mathbf{a} \times \mathbf{c})\\
&= \mathbf{a} \times (\mathbf{b} - \mathbf{c}).\\
\end{align}
From the definition of the cross product, the angle between a and bc must be zero, and these vectors must be parallel. That is, they are related by a scale factor t, leading to:
\mathbf{c} = \mathbf{b} + t\mathbf{a},
for some scalar t.
g that is only possible if bc = 0 so they are identical.
  • If a · b = a · c and a × b = a × c, for non-zero vector a, then b = c, as
\mathbf{a} \times (\mathbf{b} - \mathbf{c}) = \mathbf{0} and
\mathbf{a} \cdot (\mathbf{b} - \mathbf{c}) = 0,
so bc is both parallel and perpendicular to the non-zero vector a, something
  • From the geometrical definition, the cross product is invariant under rotations about the axis defined by a × b. In formulae:
(R\mathbf{a}) \times (R\mathbf{b}) = R(\mathbf{a} \times \mathbf{b}), with R rotation matrix.
More generally, the cross product obeys the following identity under matrix transformations:
(M\mathbf{a}) \times (M\mathbf{b}) = (\det M) M^{-T}(\mathbf{a} \times \mathbf{b})
where \scriptstyle M is a 3-by-3 matrix and \scriptstyle M^{-T} is the transpose of the inverse. It can be readily seen how this formula reduces to the former one if \scriptstyle M is a rotation matrix.
  • The cross product of two vectors lies in the null space of the 2×3 matrix with the vectors as rows:
\mathbf{a} \times \mathbf{b} \in NS\left(\begin{bmatrix}\mathbf{a} \\ \mathbf{b}\end{bmatrix}\right).
  • For the sum of two cross products, the following identity holds:
\mathbf{a} \times \mathbf{b} + \mathbf{c} \times \mathbf{d} = (\mathbf{a} - \mathbf{c}) \times (\mathbf{b} - \mathbf{d}) + \mathbf{a} \times \mathbf{d} + \mathbf{c} \times \mathbf{b}.

Differentiation of Cross product of vectors

Main article: Vector-valued function § Derivative and vector multiplication
The product rule applies to the cross product in a similar manner:
\frac{d}{dx}(\mathbf{a} \times \mathbf{b}) = \frac{d\mathbf{a}}{dx} \times \mathbf{b} + \mathbf{a} \times \frac{d\mathbf{b}}{dx}.
This identity can be easily proved using the matrix multiplication representation.

Triple product expansion.

Triple product

The cross product is used in both forms of the triple product. The scalar triple product of three vectors is defined as
\mathbf{a} \cdot (\mathbf{b} \times \mathbf{c}),
It is the signed volume of the parallelepiped with edges a, b and c and as such the vectors can be used in any order that's an even permutation of the above ordering. The following therefore are equal:
\mathbf{a} \cdot (\mathbf{b} \times \mathbf{c}) = \mathbf{b} \cdot (\mathbf{c} \times \mathbf{a}) = \mathbf{c} \cdot (\mathbf{a} \times \mathbf{b}),
The vector triple product is the cross product of a vector with the result of another cross product, and is related to the dot product by the following formula
\mathbf{a} \times (\mathbf{b} \times \mathbf{c}) = \mathbf{b}(\mathbf{a} \cdot \mathbf{c}) - \mathbf{c}(\mathbf{a} \cdot \mathbf{b}).
 This formula is used in physics to simplify vector calculations. A special case, regarding gradients and useful in vector calculus, is
\begin{align}
\nabla \times (\nabla \times \mathbf{f}) & = \nabla (\nabla \cdot  \mathbf{f} ) - (\nabla \cdot \nabla) \mathbf{f} \\
& =  \nabla (\nabla \cdot  \mathbf{f} ) - \nabla^2 \mathbf{f},\\
\end{align}
where ∇2 is the vector Laplacian operator.
Another identity relates the cross product to the scalar triple product:
(\mathbf{a}\times \mathbf{b})\times (\mathbf{a}\times \mathbf{c}) = (\mathbf{a}\cdot(\mathbf{b}\times \mathbf{c})) \mathbf{a}

Alternative formulation

The cross product and the dot product are related by:
 |\mathbf{a} \times \mathbf{b}|^2  = |\mathbf{a}|^2  |\mathbf{b}|^2 - (\mathbf{a} \cdot \mathbf{b})^2.
The right-hand side is the Gram determinant of a and b, the square of the area of the parallelogram defined by the vectors. This condition determines the magnitude of the cross product. Namely, since the dot product is defined, in terms of the angle θ between the two vectors, as:
 \mathbf{a \cdot b} = | \mathbf a | | \mathbf b | \cos \theta ,
the above given relationship can be rewritten as follows:
  |\mathbf{a \times b}|^2 = |\mathbf{a}|^2 |\mathbf{b}|^2 \left(1-\cos^2 \theta \right) .
Invoking the Pythagorean trigonometric identity one obtains:
 |\mathbf{a} \times \mathbf{b}|  = |\mathbf{a}|  |\mathbf{b}| |\sin \theta| ,
which is the magnitude of the cross product expressed in terms of θ, equal to the area of the parallelogram defined by a and b .
The combination of this requirement and the property that the cross product be orthogonal to its constituents a and b provides an alternative definition of the cross product.

Lagrange's identity

The relation:
 |\mathbf{a} \times \mathbf{b}|^2 = 
\det \begin{bmatrix}
\mathbf{a} \cdot \mathbf{a} & \mathbf{a} \cdot \mathbf{b} \\
\mathbf{a} \cdot \mathbf{b}  & \mathbf{b} \cdot \mathbf{b}\\
\end{bmatrix} = 
 |\mathbf{a}|^2  |\mathbf{b}|^2 - (\mathbf{a} \cdot \mathbf{b})^2  .
can be compared with another relation involving the right-hand side, namely Lagrange's identity expressed as:
\sum_{1 \le i < j \le n} \left(a_ib_j-a_jb_i \right)^2 =  | \mathbf a |^2 | \mathbf b |^2 - (\mathbf {a \cdot b } )^2\ ,
where a and b may be n-dimensional vectors. This also shows that the Riemannian volume form for surfaces is exactly the surface element from vector calculus. In the case where n = 3, combining these two equations results in the expression for the magnitude of the cross product in terms of its components:
 |\mathbf{a} \times \mathbf{b}|^2 = \sum_{1 \le i < j \le 3} \left(a_ib_j-a_jb_i \right)^2 = (a_1b_2  - b_1a_2)^2 + (a_2b_3 - a_3b_2)^2 + (a_3b_1-a_1b_3)^2 \ .
The same result is found directly using the components of the cross-product found from:
\mathbf{a}\times\mathbf{b}=\det \begin{bmatrix}
\mathbf{i} & \mathbf{j} & \mathbf{k} \\
a_1 & a_2 & a_3 \\
b_1 & b_2 & b_3 \\
\end{bmatrix}.
In R3 Lagrange's equation is a special case of the multiplicativity |vw| = |v||w| of the norm in the quaternion algebra.
It is a special case of another formula, also sometimes called Lagrange's identity, which is the three dimensional case of the Binet-Cauchy identity:
(\mathbf{a} \times \mathbf{b}) \cdot (\mathbf{c} \times \mathbf{d}) = (\mathbf{a} \cdot \mathbf{c})(\mathbf{b} \cdot \mathbf{d}) - (\mathbf{a} \cdot \mathbf{d})(\mathbf{b} \cdot \mathbf{c}).
If a = c and b = d this simplifies to the formula above.
The cross product occurs in the formula for the vector operator curl. It is also used to describe the Lorentz force experienced by a moving electrical charge in a magnetic field. The definitions of torque and angular momentum also involve the cross product. 

Dot product:A dot product between two vectors is a scalar quantity only having magnitude.It has a huge application in Linear Algebra which i am going discuss today.In Linear Algebra we define the dot product between a row vector and a column vector as a matrix multiplication ,Thus Dot product in Linear Algebra is matrix Multiplication of row and column matrix representing the x,y,z component of vectors as the element of matrix as shown diagramatically
 


In three-dimensional space, the dot product contrasts with the cross product of two vectors, which produces a pseudovector as the result. The dot product is directly related to the cosine of the angle between two vectors in Euclidean space of any number of dimensions.
Definition of dot product:
The dot product is often defined in one of two ways: algebraically or geometrically. The geometric definition is based on the notions of angle and distance (magnitude of vectors). The equivalence of these two definitions relies on having a Cartesian coordinate system for Euclidean space.
In modern presentations of Euclidean geometry, the points of space are defined in terms of their Cartesian coordinates, and Euclidean space itself is commonly identified with the real coordinate space Rn. In such a presentation, the notions of length and angles are not primitive. They are defined by means of the dot product: the length of a vector is defined as the square root of the dot product of the vector by itself, and the cosine of the (non oriented) angle of two vectors of length one is defined as their dot product. So the equivalence of the two definitions of the dot product is a part of the equivalence of the classical and the modern formulations of Euclidean geometry.


Algebraic definition

The dot product of two vectors A = [A1, A2, ..., An] and B = [B1, B2, ..., Bn] is defined as:
\mathbf{A}\cdot \mathbf{B} = \sum_{i=1}^n A_iB_i = A_1B_1 + A_2B_2 + \cdots + A_nB_n
where Σ denotes summation notation and n is the dimension of the vector space. For instance, in three-dimensional space, the dot product of vectors [1, 3, −5] and [4, −2, −1] is:

\begin{align}
\ [1, 3, -5] \cdot [4, -2, -1] &= (1)(4) + (3)(-2) + (-5)(-1) \\
&= 4 - 6 + 5 \\
&= 3.
\end{align}

Geometric definition or Vector Algebra definition
In Euclidean space, a Euclidean vector is a geometrical object that possesses both a magnitude and a direction. A vector can be pictured as an arrow. Its magnitude is its length, and its direction is the direction that the arrow points. The magnitude of a vector A is denoted by \|\mathbf{A}\|. The dot product of two Euclidean vectors A and B is defined by[
\mathbf A\cdot\mathbf B = \|\mathbf A\|\,\|\mathbf B\|\cos\theta,
where θ is the angle between A and B.
In particular, if A and B are orthogonal, then the angle between them is 90° and
\mathbf A\cdot\mathbf B=0.
At the other extreme, if they are codirectional, then the angle between them is 0° and
\mathbf A\cdot\mathbf B = \|\mathbf A\|\,\|\mathbf B\|
This implies that the dot product of a vector A by itself is
\mathbf A\cdot\mathbf A = \|\mathbf A\|^2,
which gives
 \|\mathbf A\| = \sqrt{\mathbf A\cdot\mathbf A},
the formula for the Euclidean length of the vector.
  
Scalar projection and first properties:
The scalar projection (or scalar component) of a Euclidean vector A in the direction of a Euclidean vector B is given by
A_B=\|\mathbf A\|\cos\theta
where θ is the angle between A and B.
In terms of the geometric definition of the dot product, this can be rewritten
A_B = \mathbf A\cdot\widehat{\mathbf B}
where \widehat{\mathbf B} = \mathbf B/\|\mathbf B\| is the unit vector in the direction of B
Application of Dot product in Trigonometry to derive Cosine Rule:
Cosine Rule in Trigonometry is related to Dot product of vectors means that using dot product we can derive Cosine rule of trigonometry as follows
Given two vectors a and b separated by angle θ (see image right), they form a triangle with a third side c = ab. The dot product of this with itself is:

\begin{align}
\mathbf{c}\cdot\mathbf{c}  & = (\mathbf{a}-\mathbf{b})\cdot(\mathbf{a}-\mathbf{b}) \\
 & =\mathbf{a}\cdot\mathbf{a} - \mathbf{a}\cdot\mathbf{b} - \mathbf{b}\cdot\mathbf{a} + \mathbf{b}\cdot\mathbf{b}\\
 & = a^2 - \mathbf{a}\cdot\mathbf{b} - \mathbf{a}\cdot\mathbf{b} + b^2\\
 & = a^2 - 2\mathbf{a}\cdot\mathbf{b} + b^2\\
 c^2 & = a^2 + b^2 - 2ab\cos \theta\\
\end{align}
which is the law of cosines.
This is an application of dot product to derive Cosine law it can also be used to derive parallelogram law of vector addition.
In physics, vector magnitude is a scalar in the physical sense, i.e. a physical quantity independent of the coordinate system, expressed as the product of a numerical value and a physical unit, not just a number. The dot product is also a scalar in this sense, given by the formula, independent of the coordinate system. Examples include:
  • Mechanical work is the dot product of force and displacement vectors.
  • Magnetic flux is the dot product of the magnetic field and the area vectors.
  
Mechanical work in physics:
For moving objects, the quantity of work/time (power) is calculated. Thus, at any instant, the rate of the work done by a force (measured in joules/second, or watts) is the scalar product of the force (a vector), and the velocity vector of the point of application. This scalar product of force and velocity is classified as instantaneous power. Just as velocities may be integrated over time to obtain a total distance, by the fundamental theorem of calculus, the total work along a path is similarly the time-integral of instantaneous power applied along the trajectory of the point of application.
Application of Dot Product in calculating Work done
Work is the result of a force on a point that moves through a distance. As the point moves, it follows a curve X, with a velocity v, at each instant. The small amount of work δW that occurs over an instant of time dt is calculated as
 \delta W = \mathbf{F}\cdot d\mathbf{s} = \mathbf{F}\cdot\mathbf{v}dt
where the F.v is the power over the instant dt. The sum of these small amounts of work over the trajectory of the point yields the work,
W =  \int_{t_1}^{t_2}\mathbf{F} \cdot \mathbf{v}dt =  \int_{t_1}^{t_2}\mathbf{F} \cdot {\tfrac{d\mathbf{s}}{dt}}dt =\int_C \mathbf{F} \cdot d\mathbf{s},
where C is the trajectory from x(t1) to x(t2). This integral is computed along the trajectory of the particle, and is therefore said to be path dependent.
If the force is always directed along this line, and the magnitude of the force is F, then this integral simplifies to
W = \int_C F\,ds
where s is distance along the line. If F is constant, in addition to being directed along the line, then the integral simplifies further to
W = \int_C F\,ds = F\int_C ds = Fs
where s is the distance travelled by the point along the line.
This calculation can be generalized for a constant force that is not directed along the line, followed by the particle. In this case the dot product F·ds = Fcosθds, where θ is the angle between the force vector and the direction of movement,[that is




W = \int_C \mathbf{F} \cdot d\mathbf{s} = Fs\cos\theta.



 Magnetic flux :It can calculated using Magnetic field density vector B dot with differential Area vector dS summed over all differential area vector over the surface as                               
\Phi_B = \iint_S \mathbf{B} \cdot d\mathbf S.
Let's see it in greater detail because it will be useful to calculate flux associated with any vector field F over any surface area S as following:

In physics, specifically electromagnetism, the magnetic flux (often denoted Φ or ΦB) through a surface is the surface integral of the normal component of the magnetic field B passing through that surface. The SI unit of magnetic flux is the weber (Wb) (in derived units: volt-seconds), and the CGS unit is the maxwell. Magnetic flux is usually measured with a fluxmeter, which contains measuring coils and electronics, that evaluates the change of voltage in the measuring coils to calculate the magnetic flux.
he magnetic interaction is described in terms of a vector field, where each point in space (and time) is associated with a vector that determines what force a moving charge would experience at that point (search Lorentz force). Since a vector field is quite difficult to visualize at first, in elementary physics one may instead visualize this field with field lines. The magnetic flux through some surface, in this simplified picture, is proportional to the number of field lines passing through that surface (in some contexts, the flux may be defined to be precisely the number of field lines passing through that surface; although technically misleading, this distinction is not important). Note that the magnetic flux is the net number of field lines passing through that surface; that is, the number passing through in one direction minus the number passing through in the other direction (see below for deciding in which direction the field lines carry a positive sign and in which they carry a negative sign). In more advanced physics, the field line analogy is dropped and the magnetic flux is properly defined as the surface integral of the normal component of the magnetic field passing through a surface. If the magnetic field is constant, the magnetic flux passing through a surface of vector area S is:
magnetic flux passing through a surface of vector area S is

\Phi_B = \mathbf{B} \cdot \mathbf{S} = BS \cos \theta,
where B is the magnitude of the magnetic field (the magnetic flux density) having the unit of Wb/m2 (tesla), S is the area of the surface, and θ is the angle between the magnetic field lines and the normal (perpendicular) to S. For a varying magnetic field, we first consider the magnetic flux through an infinitesimal area element dS, where we may consider the field to be constant:

d\Phi_B = \mathbf{B} \cdot d\mathbf{S}.
A generic surface, S, can then be broken into infinitesimal elements and the total magnetic flux through the surface is then the surface integral


\Phi_B = \iint_S \mathbf{B} \cdot d\mathbf S.
From the definition of the magnetic vector potential A and the fundamental theorem of the curl the magnetic flux may also be defined as:

\Phi_B = \oint_{\partial S} \mathbf{A} \cdot d\boldsymbol{\ell},     
where the line integral is taken over the boundary of the surface S, which is denoted ∂S.
Above derivation can be assisted by following figure
 
 If we require to project the area vector dS.n along the vector in yellow what i will do is I will take a dot product of area vector dS.n With a unit vector along pointing along yellow vector,and this is equivalent to (dS.n)*cos(theta).
Projection of dS.n along yellow vector= (dS.n)*cos(theta)

Above Derivation using above figure in slightly different manner!


Magnetic flux through a closed surface an application of Dot Product:

Gauss's law for magnetism, which is one of the four Maxwell's equations, states that the total magnetic flux through a closed surface is equal to zero. (A "closed surface" is a surface that completely encloses a volume(s) with no holes.) This law is a consequence of the empirical observation that magnetic monopoles have never been found.
In other words, Gauss's law for magnetism is the statement:
\Phi_B=\,\!\oiint\scriptstyle S\mathbf{B} \cdot d\mathbf S = 0
for any closed surface S.

Magnetic flux through an open surface an application of Dot Product:

While the magnetic flux through a closed surface is always zero, the magnetic flux through an open surface need not be zero and is an important quantity in electromagnetism. For example, a change in the magnetic flux passing through a loop of conductive wire will cause an electromotive force, and therefore an electric current, in the loop. The relationship is given by Faraday's law:
\mathcal{E} = \oint_{\partial \Sigma}\left(  \mathbf{E} +\mathbf{ v \times B}\right) \cdot d\boldsymbol{\ell} = -{d\Phi_B \over dt},
where
\mathcal{E} is the electromotive force (EMF),
ΦB is the magnetic flux through the open surface Σ,
∂Σ is the boundary of the open surface Σ; note that the surface, in general, may be in motion and deforming, and so is generally a function of time. The electromotive force is induced along this boundary.
d is an infinitesimal vector element of the contour ∂Σ,
v is the velocity of the boundary ∂Σ,
E is the electric field,
B is the magnetic field.
The two equations for the EMF are, firstly, the work per unit charge done against the Lorentz force in moving a test charge around the (possibly moving) surface boundary ∂Σ and, secondly, as the change of magnetic flux through the open surface Σ. This equation is the principle behind an electrical generator.

For an open surface Σ, the electromotive force
along the surface boundary, ∂Σ, is a combination of the boundary's motion, with velocity v, through a magnetic field B (illustrated by the generic F field in the diagram) and the induced electric field caused by the changing magnetic field.

electric flux calculation :

By way of contrast, Gauss's law for electric fields, another of Maxwell's equations, is
\Phi_E =\,\!\oiint\scriptstyle S\mathbf{E}\cdot d\mathbf{S} = \frac{Q}{\epsilon_0}\,\!
where
E is the electric field,
S is any closed surface,
Q is the total electric charge inside the surface S,
ε0 is the electric constant (a universal constant, also called the "permittivity of free space").
Note that the flux of E through a closed surface is not always zero; this indicates the presence of "electric monopoles", that is, free positive or negative charges.

So dot product has a huge application in both physics and different domain of mathematics i will come with more application in physics today let's come to mathematics complex domain.

Complex vectors and application of dot product:

Before understanding dot product in Complex number, let's understand complex number first:

Complex numbers:

Every complex number can be represented as a point in the complex plane, and can therefore be expressed by specifying either the point's Cartesian coordinates (called rectangular or Cartesian form) or the point's polar coordinates (called polar form). The complex number z can be represented in rectangular form as

z = x + iy\,
where i is the imaginary unit.This mathematical definition
z = x + iy\,      can well be mapped onto Cartesian Coordinate System as shown below
We can write any complex number
z = x + iy\,  also in polar form as shown below
z = r\cdot(\cos\varphi+i\sin\varphi)   and this can be represented onto polar coordinate system as shown below here

Polar form of complex number
z = r\cdot(\cos\varphi+i\sin\varphi)
can also be written in the compact form
z = re^{i\varphi} \,
where e is Euler's number, which are equivalent as shown by Euler's formula.[(Note that this formula, like all those involving exponentials of angles, assumes that the angle ϕ is expressed in radians.) To convert between the rectangular and polar forms of a complex number, the conversion formulae given above can be used.

For the operations of multiplication, division, and exponentiation of complex numbers, it is generally much simpler to work with complex numbers expressed in polar form rather than rectangular form. From the laws of exponentiation:
  • Multiplication:

r_0 e^{i\varphi_0} \cdot r_1 e^{i\varphi_1}=r_0 r_1 e^{i(\varphi_0 + \varphi_1)} \,
  • Division:

\frac{r_0 e^{i\varphi_0}}{r_1 e^{i\varphi_1}}=\frac{r_0}{r_1}e^{i(\varphi_0 - \varphi_1)} \,
  • Exponentiation (De Moivre's formula):


(re^{i\varphi})^n=r^ne^{in\varphi} \,

Come to application of Dot Product in Complex number

For vectors with complex entries, using the given definition of the dot product would lead to quite different properties. For instance the dot product of a vector with itself would be an arbitrary complex number, and could be zero without the vector being the zero vector (such vectors are called isotropic); this in turn would have consequences for notions like length and angle. Properties such as the positive-definite norm can be salvaged at the cost of giving up the symmetric and bilinear properties of the scalar product, through the alternative definition

\mathbf{a}\cdot \mathbf{b} = \sum{a_i \overline{b_i}}
where bi is the complex conjugate of bi. Then the scalar product of any vector with itself is a non-negative real number, and it is nonzero except for the zero vector. However this scalar product is thus sesquilinear rather than bilinear: it is conjugate linear and not linear in b, and the scalar product is not symmetric, since
 \mathbf{a} \cdot \mathbf{b} = \overline{\mathbf{b} \cdot \mathbf{a}}.
The angle between two complex vectors is then given by
\cos\theta = \frac{\operatorname{Re}(\mathbf{a}\cdot\mathbf{b})}{\|\mathbf{a}\|\,\|\mathbf{b}\|}.
This type of scalar product is nevertheless useful, and leads to the notions of Hermitian form and of general inner product spaces.
Another application of dot product in mathematics is Inner Products :The inner product generalizes the dot product to abstract vector spaces over a field of scalars, being either the field of real numbers \mathbb{R} or the field of complex numbers \mathbb{C}. It is usually denoted by \langle\mathbf{a}\, , \mathbf{b}\rangle. The inner product of two vectors over the field of complex numbers is, in general, a complex number, and is sesquilinear instead of bilinear. An inner product space is a normed vector space, and the inner product of a vector with itself is real and positive-definite.

Application of Dot Product in the projection of one function onto another function:

Dot product for projection of function onto another function

The dot product is defined for vectors that have a finite number of entries. Thus these vectors can be regarded as discrete functions: a length-n vector u is, then, a function with domain {k ∈ ℕ ∣ 1 ≤ kn}, and ui is a notation for the image of i by the function/vector u.
This notion can be generalized to continuous functions: just as the inner product on vectors uses a sum over corresponding components, the inner product on functions is defined as an integral over some interval axb (also denoted [a, b]):
\langle u , v \rangle = \int_a^b u(x)v(x)dx
Generalized further to complex functions ψ(x) and χ(x), by analogy with the complex inner product above, gives


\langle \psi , \chi \rangle = \int_a^b \psi(x)\overline{\chi(x)}dx.

In  my next paper i will come with the more application of Dot product in Physics and Image compression and problems in physics based on Dot product.

 Problems based on vector calculus : 

Electronics And communication by Md Tauseef Ibrahim/Abraham Malik