def softmax_backward(dA, activation_cache):
    """
    Description: Implements backward propagation for a softmax unit

    :param dA: the post-activation gradient
    :param activation_cache: contains Z (stored during the forward propagation)
    :return: dZ: gradient of the cost with respect to Z
    """
    AL = activation_cache['AL']
    Y = activation_cache['Y']
    dZ = AL - Y
    return dZ