$Version
(* "14.0.0 for Mac OS X ARM (64-bit) (December 13, 2023)" *)
ClearAll["Global`*"]
int[k_Integer, k_Integer] := int[k, k] =
Integrate[LegendreP[k, x]^2, {x, -1, 1}]
int[k_Integer, l_Integer] := int[k, l] =
Integrate[LegendreP[k, x]*LegendreP[l, x], {x, -1, 1}]
Table[int[k, l], {k, -3, 3}, {l, -3, 3}] //
TableForm[#, TableHeadings ->
{Range[-3, 3], Range[-3, 3]}] &
For non-negative integers,
FindSequenceFunction[
Table[{k, int[k, k]}, {k, 0, 3}], k] // Simplify
(* 2/(1 + 2 k) *)
Verifying outside of the range used in the FindSequenceFunction
And @@ Table[int[k, k] == 2/(2 k + 1), {k, 0, 50}]
(* True *)
Similarly for negative integers,
FindSequenceFunction[
Table[{k, int[k, k]}, {k, -5, -1}], k] // Simplify
(* -(2/(1 + 2 k)) *)
And @@ Table[int[k, k] == -2/(2 k + 1), {k, -50, -1}]
(* True *)
Off the main diagonal,
FindSequenceFunction[
Table[{k, int[k, -k - 1]}, {k, 0, 5}], k] // Simplify
(* 2/(1 + 2 k) *)
And @@ Table[int[k, -k - 1] == 2/(2 k + 1), {k, 0, 50}]
(* True *)
and,
FindSequenceFunction[
Table[{k, int[k, -k - 1]}, {k, -5, -1}], k] // Simplify
(* -(2/(1 + 2 k)) *)
And @@ Table[int[k, -k - 1] == -2/(2 k + 1), {k, -50, -1}]
(* True *)