In: Computer Science
Multiply the following 16 bit signed binary number together
Provide a 32bit signed binary answer
0000 0001 0001 0001
1111 1111 1000 0000

11111111111111110111011110000000
Explanation:
-------------
0000000100010001 x 1111111110000000
Let's sign extend our first number to 00000000000000000000000100010001
Let's sign extend our second number to 11111111111111111111111110000000
Two's complement binary Multiplication:
---------------------------------------
                                  00000000000000000000000100010001
                                 x11111111111111111111111110000000
-------------------------------------------------------------------
                                 00000000000000000000000000000000
                                00000000000000000000000000000000
                               00000000000000000000000000000000
                              00000000000000000000000000000000
                             00000000000000000000000000000000
                            00000000000000000000000000000000
                           00000000000000000000000000000000
                          00000000000000000000000100010001
                         00000000000000000000000100010001
                        00000000000000000000000100010001
                       00000000000000000000000100010001
                      00000000000000000000000100010001
                     00000000000000000000000100010001
                    00000000000000000000000100010001
                   00000000000000000000000100010001
                  00000000000000000000000100010001
                 00000000000000000000000100010001
                00000000000000000000000100010001
               00000000000000000000000100010001
              00000000000000000000000100010001
             00000000000000000000000100010001
            00000000000000000000000100010001
           00000000000000000000000100010001
          00000000000000000000000100010001
         00000000000000000000000100010001
        00000000000000000000000100010001
       00000000000000000000000100010001
      00000000000000000000000100010001
     00000000000000000000000100010001
    00000000000000000000000100010001
   00000000000000000000000100010001
  00000000000000000000000100010001
-------------------------------------------------------------------
                                 11111111111111110111011110000000  (we only need to calculate the 32 right most bits in the result)
-------------------------------------------------------------------
Answer: 11111111111111110111011110000000
Verification:
--------------
Let's convert 00000000000000000000000100010001 to decimal first
since left most bit is 0, this number is positive
so, we can directly convert this into a decimal value
Converting 100010001 to decimal
100010001
=> 1x2^8+0x2^7+0x2^6+0x2^5+1x2^4+0x2^3+0x2^2+0x2^1+1x2^0
=> 1x256+0x128+0x64+0x32+1x16+0x8+0x4+0x2+1x1
=> 256+0+0+0+16+0+0+0+1
=> 273
so, 00000000000000000000000100010001 in decimal is 273
Now, Let's convert 11111111111111111111111110000000 to decimal
since left most bit is 1, this number is negative number.
so, follow these steps below to convert this into a decimal value.
I. first flip all the bits. Flip all 0's to 1 and all 1's to 0.
   11111111111111111111111110000000 is flipped to 00000000000000000000000001111111
II. Add 1 to above result
00000000000000000000000001111111 + 1 = 00000000000000000000000010000000
III. Now convert this result to decimal value
Converting 10000000 to decimal
10000000
=> 1x2^7+0x2^6+0x2^5+0x2^4+0x2^3+0x2^2+0x2^1+0x2^0
=> 1x128+0x64+0x32+0x16+0x8+0x4+0x2+0x1
=> 128+0+0+0+0+0+0+0
=> 128
so, 11111111111111111111111110000000 in decimal is -128
Now, Let's convert the answer=11111111111111110111011110000000 to decimal
since left most bit is 1, this number is negative number.
so, follow these steps below to convert this into a decimal value.
I. first flip all the bits. Flip all 0's to 1 and all 1's to 0.
   11111111111111110111011110000000 is flipped to 00000000000000001000100001111111
II. Add 1 to above result
00000000000000001000100001111111 + 1 = 00000000000000001000100010000000
III. Now convert this result to decimal value
Converting 1000100010000000 to decimal
1000100010000000
=> 1x2^15+0x2^14+0x2^13+0x2^12+1x2^11+0x2^10+0x2^9+0x2^8+1x2^7+0x2^6+0x2^5+0x2^4+0x2^3+0x2^2+0x2^1+0x2^0
=> 1x32768+0x16384+0x8192+0x4096+1x2048+0x1024+0x512+0x256+1x128+0x64+0x32+0x16+0x8+0x4+0x2+0x1
=> 32768+0+0+0+2048+0+0+0+128+0+0+0+0+0+0+0
=> 34944
so, 11111111111111110111011110000000 in decimal is -34944
We can verify that 273*-128 = -34944
Hence, the answer is 11111111111111110111011110000000