Google for "Inverse Kinematics."

The simple case is "Two-bone inverse kinematics" which is simple, and can let you decide the shoulder-elbow-wrist angle.

Also, if you don't yet understand linear algebra and 3D homogenous transform matrices, you'll probably need to learn that, first. Which can take a while -- I recommend starting with a 3D graphics primer or perhaps game physics simulation tutorial of some sort.