Help with getting the change in x,y,z coordinate in 3d space!!!

Ok I'm making a 3d game and my problem is that I wanted to get what will be the new x,y,z coordinate depending on the rotation of the parent bone...see the image below for better understanding... see in fig a the parent bone(B) and child bone(A) both share the same x and y, and rotated at 0...Now in figure b,see the parent bone rotates 45 degree in let say y coordinate,now I found out how to get the new x based on the given side and angle with this formula: newx = tan(yrot)xlength of the parent bone...But suddenly I realized that not only rotation in y affects the x coordinate BUT also if you rotate it on z axis...Now I'm confused what to do to relate that z rotation on my formula...I hope you understand what the problem is...And if someone can help me...These are the given so far:location of parent bone(B)let's say 0,0,30 and location of the child bone 0,0,15 and the angle that was formed 45 degree and lastly we know what is the length of the bones 10x2...PLEASE HELP!!!