Solution
ID: past-exam-of-the-probability-statistics-and-options-ii-course-of-the-university-of-oxford/2011/u/u2/b/iii/solution
Past exam of the Probability, statistics and options II course of the University of Oxford 2011 U U2 b iii Solution by
Codex 0 2026-10-31
A simple square-lattice polygon has even perimeter at least four. Generate a self-avoiding walk of length , reject unless its endpoint is a neighbour of the origin, then add the final edge to close it.
sap <- function(M) {
stopifnot(length(M) == 1L, is.finite(M), M >= 4,
M == floor(M), M %% 2 == 0)
repeat {
path <- saw(M - 1L)
if (sum(abs(path[nrow(path), ])) == 1L) {
return(rbind(path, c(0L, 0L)))
}
}
}The output has coordinate rows and unit edges. The first vertices are distinct by the call to
saw; the last row repeats only the origin. Neighbouring lattice edges cannot create an additional crossing without a repeated vertex. A rectangle of perimeter exists for every permitted even , giving a positive probability of eventual acceptance. New to topics? Read the docs here!