Why the oxidation number of ( H ) is -1 in

1) N2H4
2) CaH2
while ( N ) is different from ( Ca ) ?

Becasue H is in group one and it loose electron to become octet. so it has -1 one charge

But it is -1 when bonded with a non metal (N) , and it's also -1 when bonded with a metal ( Ca )

Here is a simplified set of oxidation state rules.

http://www.chemteam.info/Redox/Redox-Rules.html

You must understand that oxidation rules are arbitrary rules mostly for bookkeeping. When H is with a metal, such as CaH2, I always give it an oxidation state of -1 because it's obvious this is a hydride. In N2H4, technically we may call this a hydride,too, but I always give H a +1 in anything other than a metal hydride. So I would give H in N2H4 a +1 each which makes N = -2 each. You will find in balancing redox equations that it simplifies the problem if H can be given +1 each and O a -2 each. So in NH3 I would call N -3, etc.

But there are other sources that gave -1 to H in N2H4 abd +2 to N !

To determine the oxidation numbers of atoms in a compound, we need to follow some rules and understand the concept. The oxidation number is the charge that an atom would have if electrons were transferred completely.

1) N2H4:
In N2H4, the total charge is neutral since it's an uncharged compound. The sum of the oxidation numbers of all the atoms must add up to zero. Let's assume the oxidation number of N is x.

Since N2H4 is neutral, the sum of the oxidation numbers of all the atoms is zero:
2(N) + 4(H) = 0

Substituting the values, we have:
2(x) + 4(-1) = 0
2x - 4 = 0
2x = 4
x = 2

Thus, the oxidation number of N in N2H4 is +2.

2) CaH2:
Similarly, in CaH2, the total charge is neutral. Let's assume the oxidation number of Ca is y.

The sum of the oxidation numbers of all the atoms must add up to zero:
1(Ca) + 2(H) = 0

Substituting the values, we have:
y + 2(-1) = 0
y - 2 = 0
y = 2

Thus, the oxidation number of Ca in CaH2 is +2.

In summary, the oxidation numbers of N and Ca in N2H4 and CaH2, respectively, are different because they are in different compounds with different arrangements and molecular formulas. The oxidation number is determined based on the charges required to balance the overall electrically neutral compound.