Seems like you have an index here... that's good, but also the extended public and private keys do also need indexes. In order to build one public key from another, you have to have the chain code, which is in the extended public key, but not the regular public key.