dhD  =  {{0,  0,  0,  θ1,  0}, {90,  0,  
            0,  θ2, 0}, 
{-90, 0, 
            d3, θ3, 0}, {90, 0, 0, θ4, 
            0}, 
{-90, 0, 0, θ5, 
            0}}; 
dhD //  TraditionalForm

dh  =  ConvertFromDegrees[dhD];  
    dh  //  TraditionalForm

T01  =  T[dh, 0, 1];  T01  //  TraditionalForm

T12  =  T[dh,  1, 2];  T12  //  TraditionalForm

T23  =  T[dh, 2, 3];  T23  //  TraditionalForm

T34  =  T[dh, 3, 4];  T34  //  TraditionalForm

T45  =  T[dh, 4, 5];  T45  //  TraditionalForm

T05  =  T[dh, 0, 5];  T05  //  TraditionalForm

P05  =  
      P[dh,  0,  
        5];  P05 // TraditionalForm

P05[[1]]^2  +  P05[[2]]^2  //  Simplify

T[dh, 2, 5]  //  Simplify  //  TraditionalForm

T[dh, 2, 
        0] . {{r11, r12, r13, x}, {r21, r22, r23, y}, {r31, r32, r33, z}, {0, 
          0, 0, 1}}

%  //  MatrixForm

T[dh, 0, 5]  /.  θ2 -> 0

%  //  TraditionalForm