how do you convert hexadecimal to binary?
i found this on wiki how i am not sure if its correct or not, so you may want to wait until someone else comes along and helps
Since hexadecimal is base sixteen, the "place values" correspond to the powers of sixteen. To convert to decimal, multiply each place value by the corresponding power of sixteen. Start this process by writing the powers of sixteen next to the digits of a hexadecimal number.
Since hexadecimal is base sixteen, the "place values" correspond to the powers of sixteen. To convert to decimal, multiply each place value by the corresponding power of sixteen. Start this process by writing the powers of sixteen next to the digits of a hexadecimal number.
but I eed it in binary?
why is 1011 equal to B?
Suppose \(a=a_Na_{N-1}\ldots a_1a_0\) is a number in base \(16\), where \(a_i\) is the \((i+1)\)th digit of \(a\). Then you have \[a=a_N16^N+a_{N-1}16^{N-1}+\cdots+a_116^1+a_016^0\]Observing that \(2^4=16\), you can write the above as \[a=a_N 2^{4N}+a_{N-1}2^{4(N-1)}+\cdots+a_12^4+a_02^0\]which is a number \(b\) in base \(2\) with four times as many digits. You can see this more clearly by filling in the missing powers of \(2\): \[b=\color{red}{a_N2^{4N}}+0\times2^{4N-1}+0\times2^{4N-2}+0\times2^{4N-3}+\color{red}{a_{N-1}2^{4N-4}}+\cdots\]This would suggest the conversion is just a matter of adding three zeros between each digit of \(a\): \[b=a_N000a_{N-1}000\cdots a_1000a_0\]However, the digits of a binary number can only be \(1\) or \(0\), while the digits of \(a\) belong to \(\{0,1,\ldots,9,\mathrm{a},\ldots,\mathrm{f}\}\). To get around this, all you need to do is write replace each \(a_i000\) with the appropriate four-digit binary representation of \(a_i\). For example, if \(a=\mathrm{f}\) (\(15\) in decimal), then \(b=\mathrm{f}000=1111\) because \(\mathrm{f}_{16}=1111_2\). In less words: convert each digit of \(a\) into binary and catenate them.
Another example just to make sure it's clear what you do. Consider \(a=\mathrm{a}05\mathrm{f}_{16}\). To convert to binary, convert each digit of \(a\) into a four-digit binary number and join them together: \[\mathrm{a}_{16}=1010_2\\ 0_{16}=0000_2\\ 5_{16}=0101_2\\ \mathrm{f}_{16}=1111_2\]and so \(\mathrm{a}05\mathrm{f}_{16}=1010\,0000\,0101\,1111_2\).
im not sure why hex Binary 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 its this way'
Let me make you a clearer table, and you tell me what about it is unclear: \[\begin{array}{r|r|r} \text{dec}&\text{bin}&\text{hex}\\ \hline 0&0000&0\\ 1&0001&1\\ 2&0010&2\\ 3&0011&3\\ 4&0100&4\\ 5&0101&5\\ 6&0110&6\\ 7&0111&7\\ 8&1000&8\\ 9&1001&9\\ 10&1010&\mathrm{a}\\ 11&1011&\mathrm{b}\\ 12&1100&\mathrm{c}\\ 13&1101&\mathrm{d}\\ 14&1110&\mathrm{e}\\ 15&1111&\mathrm{f}\\ 16&1\,0000&10\\ 17&1\,0001&11 \end{array}\]
thank you. how is bin 0001 equal to hex 1? because 0(2^3) + 0(2^2) + 0(2^1) + 1(2^0) = 0
For any non-zero number \(x\), you have \(x^0=1\), not \(0\).
could you apply that to other ones and show me an example?..
I'm not sure what you mean by applying this fact to "the other ones"
how is 0010 equal to 2?
That's because \(0010_2=0\times2^3+0\times2^2+1\times2^1+0\times2^0=2_{10}\). This number has the same representation in both decimal and hexadecimal because \(2_{10}=2\times10^0\) and \(2_{16}=2\times16^0\).
and its the same with decimal
Right, the number \(2\) has the same representation in every base higher than base \(2\).
thank yo. I barely understood your first comment. it was kind of sccary
Sorry if it seemed intimidating at first. I was hoping to give a general method for converting from hex to binary with the reasoning as to why it works. If you're not sure how to put it into practice, feel free to share some specific conversion problems you're working on. That might help you understand better how the method is applied.
Join our real-time social learning platform and learn together with your friends!