In how many ways can a $5 \times 5$ matrix be formed such that sum of row elements and column elements are $4$ and entries are $0$ or $1$? Let we have a $5 \times 5$ matrix and the elements can be either $0$ or $1$ and the sum of elements of each row and column is $4$ then in how many ways can the matrix be formed ?
I tried doing it in induction method. but I don't think that's a good approach. Could anyone help ? 
 A: Hint: How many 1's must each row contain? And thus how many 0's? And what about each column?
Based on this, can you come up with a combinatorial formula for counting the possible ways in which the 0's can be placed in the matrix?  (Hint #2: Think about permutations.)

OK, let me be a little more explicit.  I assume you've already figured out that each row must contain exactly one zero.  We can place that zero in any column we want — but once we do, we cannot put any more zeros in that column.
So, for the first row, there are five possible columns we can put the zero in.  For the second row, only four possible columns remain.  For the third row, there are only three columns we can place the zero in, and so on.
Can you pick it up from here?
A: This is equivalent to rooks problem,we have a $5\times5$ chessboard and we want to place $5$ rooks which neither of them attacks another (place rooks in zeroes). This can be done in $5!$ ways.
A: For your interest, there is no closed expression for the generalised version of your question: 
"In how many ways can a $N \times N$ matrix be formed such that all the entries are 0/1, and that the sum of each column and row is $P$?" 
However, a table of values for all combinations of up to $0 < P < N \leq 30$ can be found at "Counts of semiregular 0-1 matrices". 
The values relevant to this specific question are all those of the form $B(n,p; n,p)$.
For convenience, I have listed some of them below (excluding symmetrical equivalents).
$$\begin{array}{rrr}
N & P & \text{count} \\ \hline
2 & 1 &  2 \\ \hline
3 & 1 & 6 \\ \hline
4 & 1 & 24 \\
4 & 2 & 90 \\ \hline
5 & 1 & 120 \\
5 & 2 & 2040 \\ \hline 
6 & 1 & 720 \\
6 & 2 & 67950 \\
6 & 3 &  297200 \\ \hline
7 & 1 &  5040 \\
7 & 2 & 3110940 \\
7 & 3 & 68938800 \\ \hline
8 & 1 &  40320 \\
8 & 2 &  187530840 \\
8 & 3 &  24046189440 \\
8 & 4 &  116963796250 \\ \hline
\end{array}$$
As you can see the for n=5 and P=1, (which is complementary to n=5, P=4) there are 120 combinations.
