# How should one compute the p-values of a two sided F test?

I have been studying this link. However, i can't really figure out how to calculate the p value for a 2 sided F test where the degrees of freedom are different and the F distribution is asymmetric.

I looked at this as well, where the answer says "The p-value is then the largest α that would lead to rejection, which is equivalent to adding the one tailed p-value above to the one-tailed p-value in the other tail for the degrees of freedom interchanged. "

I do not understand the "degrees of freedom interchanged" part.

According to the answer, the p value computed in R would be (1-pf(val, df1= n1, df2=n2, lower.tail = T)) + (1-pf(val, df1=n2, df2=n1, lower.tail =T)) But I just do not understand why ?

Mathematically and in R, how should the p-values of a two-sided F test be calculated where the degrees of freedom are different?