In a given compound that contains three elements (e.g. a metal, a non-metal, and hydrogen), how can it be determined whether hydrogen is connected to the metal or the non-metal so that its oxidation number can be assigned accordingly?
You can look at the electronegativity of the atom Hydrogen is bonded too.
For instance, in NaH the electronegativity of H is greater than that of Na (~2.1 as opposed ~.9) so H two would have an oxidation state of -1)
In HCl, we observe that Cl is more electronegative so it will have an oxidation state of -1 and H will have an oxidation state of +1
In borane (even though B is a non-metal) each hydrogen displays an oxidation state of -1 (again electronegativity of H is 2.1 as opposed 2.0 of B)
Hope this makes sense.
When hydrogen is with a metal its oxidation number is -1 When it is with a non metal element its oxidation number is +1 In this case most probably it should be -1