def relu_backward(dA, activation_cache):
    """
    Description: Implements backward propagation for a ReLU 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
    """
    derivative = activation_cache
    derivative[derivative >= 0] = 1
    derivative[derivative < 0] = 0
    dZ = dA * derivative
    return dZ