# Broadcasting in Numpy

Broadcasting is one of the strongest features of Numpy, which makes it more usable. So, Broadcasting is just the concept of how Numpy will handle different shapes of the array during arithmetic operations. General Principles for broadcasting:

**Case 1**: If there is an (m,n) matrix and we need to perform any operation(+,-,*,/) with a matrix of size (1,n) then it will automatically convert the (1,n)->(m,n).

**Case 2:**If there is an (m,n) matrix and we need to perform any operation(+,-,*,/) with a matrix of size (m,1) then it will automatically convert the (m,1)->(m,n)

**Case 3:**If there is an (m,1) matrix and we need to perform any operation(+,-,*,/) with a matrix of size (1,1) then it will automatically convert the (1,1)->(m,1)

**Case 4:**If there is a (1,m) matrix and we need to perform any operation(+,-,*,/) with a matrix of size (1,1) then it will automatically convert the (1,1)->(1,m)

Now, I would like to illustrate an example which will let you know the application of broadcasting in data science. This is one of the examples which was discussed by Godfather of AI, Andrew Ng in one of his course. I hope it will make easy to understand.

#### Application of Broadcasting

In the above example, you are able to understand how the calc(1,4) array is dividing the A(3,4) matrix through broadcasting.